Skip to content

Instantly share code, notes, and snippets.

@omarkurt
Created May 18, 2017 21:41
Show Gist options
  • Save omarkurt/c538d5fd4bf277fd97a71d73c0ae2bff to your computer and use it in GitHub Desktop.
Save omarkurt/c538d5fd4bf277fd97a71d73c0ae2bff to your computer and use it in GitHub Desktop.
require 'pipeline/tasks/base_task'
require 'pipeline/util'
require 'nokogiri'
class Pipeline::AltDNSScanner < Pipeline::BaseTask
Pipeline::Tasks.add self
include Pipeline::Util
def initialize(trigger, tracker)
super(trigger, tracker)
@name = 'AltDNSScanner'
@description = "AltDNS Subdomain scanner"
@stage = :code
@labels << "code" << "python" << "rails"
end
def run
Dir.chdir '/home/app/tools/altdns'
@results_file = Tempfile.new(['altdnsresult', '.txt'])
# ./altdns.py -i subdomains.txt -o data_output -w words.txt -r -s results_output.txt
runsystem(true,'python', 'altdns.py', '-i', 'subdomains.txt', '-o', 'data_output', '-w', 'words.txt', '-r', '-s', "#{@results_file.path}")
@result = File.open("#{@results_file.path}").read
end
def analyze
begin
@result.each_line do |line|
description = "Subdomain detected Detected"
uri = line
namelink = null
bug_type = 'website issue'
severity = "High "
location = ""
line = ""
code = ""
user_input = ""
advisory = ""
solution = ""
cvss_score = ""
file = ""
source = {:scanner => @name, :file => file, :line => line, :code => code}
fprint = fingerprint("#{description}#{uri}#{namelink}")
report bug_type,description,source,severity,fprint,line,location,user_input, advisory,solution,cvss_score
end
rescue Exception =>e
Pipeline.warn e.message
Pipeline.warn e.backtrace
end
ensure
FileUtils.rm @results_file
end
def supported?
cmd = `/home/app/tools/altdns/altdns.py -v`
return cmd.to_s.include?("altdns.py") ? true: false
end
end
@vickybyou
Copy link

@omarkurt i tried adding AltDNSScanner tool to Jackhammer but i don't think its working. Can you help me how to integrate this tool and the steps.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment