Compare commits

...

7 Commits

Author SHA1 Message Date
Dionysus 76cad6e9e0
added flood control 2023-07-23 01:08:56 -04:00
Dionysus 4e3b67ca87
debug mode 2023-07-23 00:43:46 -04:00
Dionysus 19597e4bf5
remove comments 2023-07-23 00:31:38 -04:00
Dionysus 950b75d56c
fixed fifo 2023-07-23 00:30:23 -04:00
Dionysus a82838997f
Updated ping out timer 2023-07-23 00:02:40 -04:00
Dionysus b77c5aed87
Removed oper check lines dont need oper 2023-07-22 23:52:39 -04:00
Dionysus ba9f5107ce
Added missing semicolon 2023-07-22 23:46:49 -04:00
1 changed files with 14 additions and 14 deletions

View File

@ -1,17 +1,13 @@
#!/usr/bin/env python
# Tail Bot for syn (cause fuck gh0st and his skid scripts) - Developed by acidvegas in Python (https://git.acid.vegas/archive)
'''
WOAH LOOK NO 3RD PARTY LIBRARIES
WOW NO USELESS FUNCTIONS JUST THAT PASS AND ARE DECLARED FOR NO REASON
WOW SIMPLE CODE WRITTEN THE CORRECT WAY
'''
import asyncio
import aiofiles
import pathlib
import ssl
import time
import urllib.request
import os
class connection:
server = 'irc.supernets.org'
@ -19,7 +15,7 @@ class connection:
ipv6 = False
ssl = True
vhost = None
channel = '#honeypot'
channel = '#dev'
key = None
modes = None
@ -65,18 +61,23 @@ class Bot():
await self.sendmsg(chan, '[{0}] {1} {2}'.format(color('ERROR', red), msg, color(f'({reason})', grey))) if reason else await self.sendmsg(chan, '[{0}] {1}'.format(color('ERROR', red), msg))
async def loop_tail(self):
if not os.path.exists(FIFO_PATH)
if not os.path.exists(FIFO_PATH):
os.mkfifo(FIFO_PATH)
while True:
with open(FIFO_PATH) as fifo:
async with aiofiles.open(FIFO_PATH) as fifo:
while True:
try:
self.sendmsg(connection.channel, FIFO_PATH.read_text())
log_line = FIFO_PATH.read_text()
for line in log_line.splitlines():
await self.sendmsg(connection.channel, log_line)
await asyncio.sleep(0.1)
except Exception as ex:
try:
self.irc_error(connection.channel, 'Error occured in the loop_tail function!', ex)
await self.irc_error(connection.channel, 'Error occured in the loop_tail function!', ex)
break
except:
error('Fatal error occured in the loop_tail functions!', ex)
break
async def connect(self):
while True:
@ -89,7 +90,7 @@ class Bot():
'family' : 10 if connection.ipv6 else 2,
'local_addr' : connection.vhost
}
self.reader, self.writer = await asyncio.wait_for(asyncio.open_connection(**options), 15)
self.reader, self.writer = await asyncio.wait_for(asyncio.open_connection(**options), 30)
await self.raw(f'USER {identity.username} 0 * :{identity.realname}')
await self.raw('NICK ' + identity.nickname)
except Exception as ex:
@ -114,12 +115,11 @@ class Bot():
elif args[0] == 'PING':
await self.raw('PONG '+args[1][1:])
elif args[1] == '001':
await asyncio.sleep(5)
if connection.modes:
await self.raw(f'MODE {identity.nickname} +{connection.modes}')
if identity.nickserv:
await self.sendmsg('NickServ', f'IDENTIFY {identity.nickname} {identity.nickserv}')
if identity.operator:
await self.raw('OPER hates {identity.operator}')
await self.raw(f'JOIN {connection.channel} {connection.key}') if connection.key else await self.raw('JOIN ' + connection.channel)
self.loops['tail'] = asyncio.create_task(self.loop_tail())
elif args[1] == '433':