Skip to content

Instantly share code, notes, and snippets.

import java.math.BigInteger;
public class hahaha
{
public static void main(String[] args)
{
BigInteger a = new BigInteger("0");
BigInteger b = new BigInteger("1");
float number = 1000000;
while(number-- > 1)
#!/usr/bin/env python
from lxml import etree
def main():
doc = etree.parse("scan.xml")
for x in doc.xpath("//host[ports/port[state[@state='open']]]"):
for addr in x.xpath("address/@addr"):
print addr
for openz in x.xpath("ports/port[state[@state='open']]"):
print ' ',' '.join([str(items) for items in openz.attrib.values()])
We couldn’t find that file to show.
@d1b
d1b / IMACLIENT.c
Created May 6, 2011 12:02
haxsyslogz.py
#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);
@d1b
d1b / iptables from kmsg.py
Created May 7, 2011 15:21
iptables from kmsg.py
import sys
import socket
def return_red(string):
return "\033[1;31m" + string + "\033[m"
console = open("/dev/console", "w")
while True:
f = open("/proc/kmsg", 'r')
from scapy.all import *
from scapy.config import conf
from scapy.themes import DefaultTheme
def more_info(packet):
print packet.summary()
if packet.haslayer('IPv6'):
print "%s " % packet.show()
#else:
#print packet.summary()
import socket
f = open('/proc/net/arp', 'r')
data = f.readlines()
#print data
f.close()
def get_hostname(ip):
try:
return socket.gethostbyaddr(ip)[0]
#include <linux/module.h>
#include <linux/kernel.h>
#include <linux/fs.h>
#include <asm/uaccess.h>
#define DRIVER_AUTHOR "Dave B. <db@d1b.org>"
#define DRIVER_DESC "Rickroll ;)"
#define DEVICE_NAME "chardev"
MODULE_LICENSE("GPL");
@d1b
d1b / usb_device_monitor.py
Created August 9, 2011 16:49
python_gnome_unlock_on_usb_device
import time
import subprocess
def is_screen_locked():
output = subprocess.Popen(["gnome-screensaver-command", "--query"], stdout=subprocess.PIPE).communicate()[0]
if "screensaver is inactive" in output:
return False
return True
def monitor_and_unlock(usb_id):
@d1b
d1b / shorewall-log-kmsg-parser.py
Created September 10, 2011 07:57
shorewall-log-kmsg-parser
import sys
import socket
def return_red(string):
return "\033[1;31m" + string + "\033[m"
console = open("/dev/console", "w")
while True:
f = open("/proc/kmsg", 'r')