Skip to content

Commit

Permalink
fixed error on useragents flag. should work now
Browse files Browse the repository at this point in the history
  • Loading branch information
CausticKirbyZ committed Dec 14, 2021
1 parent 08334f6 commit 33d1979
Show file tree
Hide file tree
Showing 15 changed files with 34 additions and 28 deletions.
13 changes: 6 additions & 7 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ init:
shards install



spraycannon:
crystal build -p src/spraycannon.cr

Expand All @@ -41,9 +40,9 @@ uninstall:

clean:
rm -rf lib/
rm spdb
rm spraycannon
rm spraycannon.1
rm spraycannon.1.gz
rm shard.lock

if [ -f spdb ]; then rm spdb; fi
if [ -f spray.db ]; then rm spray.db; fi
if [ -f spraycannon ]; then rm spraycannon; fi
if [ -f spraycannon.1 ]; then rm spraycannon.1; fi
if [ -f spraycannon.1.gz ]; then rm spraycannon.1.gz; fi
if [ -f shard.lock ]; then rm shard.lock; fi
1 change: 1 addition & 0 deletions config.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# this isnt implemented yet
webhooks:
Teams:
- "put webhook url here"
Expand Down
2 changes: 1 addition & 1 deletion src/spray_types/ExchangeEAS.cr
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ class ExchageEAS < Sprayer
client = HTTP::Client.new(url, tls: context)
header = HTTP::Headers{
"Authorization" => "Basic #{ Base64.strict_encode( "#{@domain}\\#{username}:#{password}" ) }",
"User-Agent" => @useragents[rand(0..@useragents.size)]
"User-Agent" => @useragents[rand(0..(@useragents.size - 1))],
}

page = nil
Expand Down
2 changes: 1 addition & 1 deletion src/spray_types/ExchangeOWA.cr
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ class ExchangeOWA < Sprayer
client = HTTP::Client.new(url, tls: context)
# and some basic header options
header = HTTP::Headers{ # headers for post request
"User-Agent" => @useragents[rand(0..@useragents.size)],
"User-Agent" => @useragents[rand(0..(@useragents.size - 1))],
"Accept" => "*/*",
"Accept-Language" => "en-US,en;q=0.5",
"Accept-Encoding" => "gzip, deflate",
Expand Down
2 changes: 1 addition & 1 deletion src/spray_types/adfs_forms.cr
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ class ADFS_forms < Sprayer
client = HTTP::Client.new(url, tls: context)
# and some basic header options
header = HTTP::Headers{ # headers for post request
"User-Agent" => @useragents[rand(0..@useragents.size)],
"User-Agent" => @useragents[rand(0..(@useragents.size - 1))],
"Accept" => "text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,*/*;q=0.8",
"Accept-Language" => "en-US,en;q=0.5",
"Accept-Encoding" => "gzip, deflate",
Expand Down
15 changes: 8 additions & 7 deletions src/spray_types/cisco_vpn.cr
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
require "http/client"

class Cisco_VPN < Sprayer

property domain : String
## only uncomment if needed
# def initialize(usernames : Array(String), password : Array(String))
# # init any special or default variables here
# super()
# end
def initialize(usernames : Array(String), password : Array(String))
# init any special or default variables here
super
@domain = ""
end

# returns an array of [username, password, valid, lockout, mfa]
def spray(username : String, password : String)
Expand All @@ -28,13 +29,13 @@ class Cisco_VPN < Sprayer
client = HTTP::Client.new(url, tls: context)
# and some basic header options
header = HTTP::Headers{ # headers for post request
"User-Agent" => @useragents[rand(0..@useragents.size)],
"User-Agent" => @useragents[rand(0..(@useragents.size - 1))],
"Accept" => "text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,*/*;q=0.8",
"Accept-Language" => "en-US,en;q=0.5",
"Accept-Encoding" => "gzip, deflate",
"Content-Type" => "application/x-www-form-urlencoded"
}
form = "tgroup=&next=&tgcookieset=&username=#{URI.encode_www_form(username)}&password=#{URI.encode_www_form(password)}&Login=Login"
form = "tgroup=&next=&tgcookieset=&group_list=#{URI.encode_www_form(@domain)}&username=#{URI.encode_www_form(username)}&password=#{URI.encode_www_form(password)}&Login=Login"

# here is the basic
page = client.post(path, headers: header, form: form)
Expand Down
2 changes: 1 addition & 1 deletion src/spray_types/fortigate.cr
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ class VPNFortigate < Sprayer

client = HTTP::Client.new(url, tls: context)
header = HTTP::Headers{
"User-Agent" => @useragents[rand(0..@useragents.size)],
"User-Agent" => @useragents[rand(0..(@useragents.size - 1))],
"Accept" => "*/*",
"Accept-Language" => "en-US,en;q=0.5",
"Accept-Encoding" => "gzip, deflate",
Expand Down
2 changes: 1 addition & 1 deletion src/spray_types/fortigate_login.cr
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ class Fortigate_Login < Sprayer

client = HTTP::Client.new(url, tls: context)
header = HTTP::Headers{
"User-Agent" => @useragents[rand(0..@useragents.size)],
"User-Agent" => @useragents[rand(0..(@useragents.size - 1))],
"Accept" => "*/*",
"Accept-Language" => "en-US,en;q=0.5",
"Accept-Encoding" => "gzip, deflate",
Expand Down
2 changes: 1 addition & 1 deletion src/spray_types/infinatecampus.cr
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ class InfinateCampus < Sprayer
# and some basic header options
header = HTTP::Headers{ # headers for post request
# "User-Agent" => "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101 Firefox/91.0",
"User-Agent" => @useragents[rand(0..@useragents.size)],
"User-Agent" => @useragents[rand(0..(@useragents.size - 1))],
"Accept" => "*/*",
"Accept-Language" => "en-US,en;q=0.5",
"Accept-Encoding" => "gzip, deflate",
Expand Down
2 changes: 1 addition & 1 deletion src/spray_types/o365.cr
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ class O365 < Sprayer
client = HTTP::Client.new(url, tls: context)
header = HTTP::Headers{
# "User-Agent" => "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:89.0) Gecko/20100101 Firefox/89.0",
"User-Agent" => @useragents[rand(0..@useragents.size)],
"User-Agent" => @useragents[rand(0..(@useragents.size - 1))],
"Accept" => "application/json",
"Content-Type" => "application/x-www-form-urlencoded"
}
Expand Down
2 changes: 1 addition & 1 deletion src/spray_types/sonicwall_digest.cr
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ class Sonicwall_Digest < Sprayer

postheader = HTTP::Headers{
# "User-Agent" => "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:89.0) Gecko/20100101 Firefox/90.0",
"User-Agent" => @useragents[rand(0..@useragents.size)],
"User-Agent" => @useragents[rand(0..(@useragents.size - 1))],
"Content-Type" => "application/x-www-form-urlencoded",
"Cookie" => "temp=; SessId=#{sessionid}",
"Accept" => "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8",
Expand Down
2 changes: 1 addition & 1 deletion src/spray_types/spiceworks.cr
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ class Spiceworks < Sprayer

header = HTTP::Headers{ # headers for post request
# "User-Agent" => "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101 Firefox/91.0",
"User-Agent" => @useragents[rand(0..@useragents.size)], # use a random useragent from the list available
"User-Agent" => @useragents[rand(0..(@useragents.size - 1))], # use a random useragent from the list available
# "Host" => "#{url.host}",
"Accept" => "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8",
"Accept-Language" => "en-US,en;q=0.5",
Expand Down
4 changes: 2 additions & 2 deletions src/spray_types/sprayer.cr
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ class Sprayer
already_sprayed = [] of String
valid_accounts = [] of String
queued_count = 0 # int to keep track of ammount still queued

# create list of already sprayed user:passwords
if db
already_sprayed = get_dbsprayed(db).as(Array(String))
Expand Down Expand Up @@ -322,7 +322,7 @@ class Sprayer

# sleep until queued count finishes
while queued_count > 0
print "\rItems in queue to be sprayed: #{queued_count} "
print "\rItems in queue to be sprayed: #{queued_count} "
sleep 1
end
return
Expand Down
2 changes: 1 addition & 1 deletion src/spray_types/template.cr
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ class Template < Sprayer
client = HTTP::Client.new(url, tls: context)
# and some basic header options
header = HTTP::Headers{ # basic template for headers for post/get request
"User-Agent" => @useragents[rand(0..@useragents.size)], # uses a random header theres only 1 by default
"User-Agent" => @useragents[rand(0..(@useragents.size - 1))], # uses a random header theres only 1 by default
"Accept" => "*/*",
"Accept-Language" => "en-US,en;q=0.5",
"Accept-Encoding" => "gzip, deflate",
Expand Down
9 changes: 7 additions & 2 deletions src/spraycannon.cr
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@ options = {
"spraytype" => nil,
"user-as-password" => false,
"verbose" => false,
# "target" => "",
"target" => [] of String,
"usernames" => [] of String,
"passwords" => [] of String,
Expand Down Expand Up @@ -209,7 +208,10 @@ else
"Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:89.0) Gecko/20100101 Firefox/89.0",
"Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:90.0) Gecko/20100101 Firefox/90.0",
"Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101 Firefox/91.0",
"Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:92.0) Gecko/20100101 Firefox/92.0"
"Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:92.0) Gecko/20100101 Firefox/92.0",
"Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:93.0) Gecko/20100101 Firefox/93.0",
"Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:94.0) Gecko/20100101 Firefox/94.0",
"Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:95.0) Gecko/20100101 Firefox/95.0"
]
end
# exit 1
Expand Down Expand Up @@ -282,6 +284,7 @@ when "o365","office365","msol"
when "cisco_vpn" # need to go find a vpn to check it on and port the ruby file (and find the ruby file )
# STDERR.puts "Not implemented yet"
s = Cisco_VPN.new(options["usernames"].as(Array(String)),options["passwords"].as(Array(String)))
s.domain = options["domain"].as(String)
# exit 0
when "vpn_sonicwall_digest"
s = Sonicwall_Digest.new(options["usernames"].as(Array(String)),options["passwords"].as(Array(String)))
Expand Down Expand Up @@ -358,6 +361,8 @@ if options["user-password"]
s.upf = true
end

s.useragents = options["useragents"].as(Array(String)) if options["useragents"].as(Array(String)).size > 0

# puts "rand: #{max(rand())}"
start_time = Time.local.to_s("%Y-%m-%d %H:%M:%S")
STDERR.puts "Starting spraying at: " + "#{Time.local.to_s("%Y-%m-%d %H:%M:%S")}".colorize(:yellow).to_s
Expand Down

0 comments on commit 33d1979

Please sign in to comment.