1
mirror of git://git.acid.vegas/archive.git synced 2024-11-14 20:26:41 +00:00

fixed fifo

This commit is contained in:
Dionysus 2023-07-23 00:30:23 -04:00
parent a82838997f
commit 950b75d56c
Signed by: acidvegas
GPG Key ID: EF4B922DB85DC9DE

View File

@ -1,17 +1,13 @@
#!/usr/bin/env python #!/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) # 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 asyncio
import aiofiles
import pathlib import pathlib
import ssl import ssl
import time import time
import urllib.request import urllib.request
import os
class connection: class connection:
server = 'irc.supernets.org' server = 'irc.supernets.org'
@ -19,7 +15,7 @@ class connection:
ipv6 = False ipv6 = False
ssl = True ssl = True
vhost = None vhost = None
channel = '#honeypot' channel = '#dev'
key = None key = None
modes = None modes = None
@ -68,15 +64,17 @@ class Bot():
if not os.path.exists(FIFO_PATH): if not os.path.exists(FIFO_PATH):
os.mkfifo(FIFO_PATH) os.mkfifo(FIFO_PATH)
while True: while True:
with open(FIFO_PATH) as fifo: async with aiofiles.open(FIFO_PATH) as fifo:
while True: while True:
try: try:
self.sendmsg(connection.channel, FIFO_PATH.read_text()) await self.sendmsg(connection.channel, FIFO_PATH.read_text())
except Exception as ex: except Exception as ex:
try: 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: except:
error('Fatal error occured in the loop_tail functions!', ex) error('Fatal error occured in the loop_tail functions!', ex)
break
async def connect(self): async def connect(self):
while True: while True:
@ -89,7 +87,7 @@ class Bot():
'family' : 10 if connection.ipv6 else 2, 'family' : 10 if connection.ipv6 else 2,
'local_addr' : connection.vhost 'local_addr' : connection.vhost
} }
self.reader, self.writer = await asyncio.wait_for(asyncio.open_connection(**options), 300) 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(f'USER {identity.username} 0 * :{identity.realname}')
await self.raw('NICK ' + identity.nickname) await self.raw('NICK ' + identity.nickname)
except Exception as ex: except Exception as ex:
@ -114,6 +112,7 @@ class Bot():
elif args[0] == 'PING': elif args[0] == 'PING':
await self.raw('PONG '+args[1][1:]) await self.raw('PONG '+args[1][1:])
elif args[1] == '001': elif args[1] == '001':
await asyncio.sleep(5)
if connection.modes: if connection.modes:
await self.raw(f'MODE {identity.nickname} +{connection.modes}') await self.raw(f'MODE {identity.nickname} +{connection.modes}')
if identity.nickserv: if identity.nickserv:
@ -124,9 +123,9 @@ class Bot():
error('The bot is already running or nick is in use.') error('The bot is already running or nick is in use.')
except (UnicodeDecodeError, UnicodeEncodeError): except (UnicodeDecodeError, UnicodeEncodeError):
pass pass
except Exception as ex: # except Exception as ex:
error('fatal error occured', ex) # error('fatal error occured', ex)
break # break
finally: finally:
self.last = time.time() self.last = time.time()