Created
May 6, 2011 12:02
-
-
Save d1b/958828 to your computer and use it in GitHub Desktop.
haxsyslogz.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import socket | |
import struct | |
import thread | |
try: | |
from socket import SO_PEERCRED | |
except ImportError: | |
SO_PEERCRED = 17 | |
def handle_connect(conn, creds): | |
while True: | |
data = conn.recv(2048) | |
if data == "": | |
break | |
print data | |
print creds | |
def not_async(location="/dev/log"): | |
s = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM) | |
s.bind(location) | |
s.listen(128) | |
while True: | |
conn, addr = s.accept() | |
creds = struct.unpack('3i', s.getsockopt(socket.SOL_SOCKET, SO_PEERCRED, struct.calcsize('3i')) ) | |
thread.start_new_thread(handle_connect, (conn, creds) ) | |
def main(): | |
not_async() | |
if __name__=="__main__": | |
main() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <stdlib.h> | |
#include <unistd.h> | |
#include <sys/socket.h> | |
#include <sys/types.h> | |
#include <sys/un.h> | |
#include <syslog.h> | |
#include <string.h> | |
int morespammy(void); | |
int spam(void); | |
int main() | |
{ | |
while(1) | |
{ | |
openlog("Sup Dog", LOG_CONS, 0); | |
morespammy(); | |
} | |
return 0; | |
} | |
int morespammy(void) | |
{ | |
syslog(3, "%s", "Sup Dog I put a Log in ur Log in Log!"); | |
return 0; | |
} | |
int spam(void) | |
{ | |
int sock; | |
char * location = "/dev/log"; | |
char * message = "Sup Dog I put a Log in ur Log in Log!"; | |
struct sockaddr_un name; | |
sock = socket(AF_UNIX, SOCK_STREAM, 0); | |
if (!sock) | |
{ | |
printf("herp derp can't socket!\n"); | |
return 1; | |
} | |
memset(&name, 0, sizeof(name) ); | |
name.sun_family = AF_UNIX; | |
strcpy(name.sun_path, location); | |
/* connect */ | |
if (connect(sock, (struct sockaddr * ) & name, sizeof(name) ) < 0 ) | |
{ | |
printf("...derp!!! connectz\n"); | |
} | |
send(sock, message, sizeof(message), 0); | |
close(sock); | |
return 0; | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment