This file contains 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
#!/usr/bin/env python | |
# Ident lookup for incoming connections | |
# RFC 1413 - Identification Protocol | |
import socket | |
def lookup_ident(host, server_port, client_port): | |
s = socket.socket(socket.AF_INET6, socket.SOCK_STREAM) | |
s.settimeout(1) | |
try: | |
s.connect((host, 113)) |
This file contains 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 <pcap.h> | |
#include <stdlib.h> | |
#include <stdio.h> | |
#include <sys/time.h> | |
#define IP_SRC_OFFSET 34-8 | |
#define IP_DST_OFFSET 38-8 | |
void dump(char *name); |
This file contains 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
#!/usr/bin/env python | |
import sys | |
from os.path import basename | |
from dns import resolver, reversename | |
import socket | |
def get_single_reverse(ip): | |
rname = reversename.from_address(ip) | |
try: | |
responses = resolver.query(rname, "PTR") |
This file contains 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
#!/usr/bin/env python3.1 | |
import urllib.request | |
opener = urllib.request.FancyURLopener() | |
f = opener.open('https://localhost/url') | |
print(f.read()) |
This file contains 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
#!/usr/bin/env python3 | |
from tempfile import NamedTemporaryFile | |
from subprocess import call | |
import plistlib | |
with NamedTemporaryFile() as f: | |
call(['system_profiler', '-xml', 'SPPowerDataType'], stdout=f) | |
f.seek(0) | |
p = plistlib.readPlist(f) |
This file contains 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
#!/usr/bin/env python | |
# -*- coding: utf-8 -*- | |
# https://gist.github.com/1218504 | |
""" | |
generate_test_data.py | |
Copyright (c) 2010-2011 Kapsi Internet-käyttäjät ry. All rights reserved. | |
""" | |
import sys |
This file contains 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
#!/usr/bin/env python | |
import socket | |
import sys | |
PREFIX = "PREFIX:" | |
HOST = '127.0.0.1' | |
PORT = 5555 | |
s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) |
This file contains 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
#!/usr/bin/env python3 | |
# encoding: utf-8 | |
# By Joonas Kuorilehto 2011, MIT license | |
# | |
# The script combines .ssh/known_hosts so that each fingerprint is only | |
# listed once. | |
import re | |
import sys | |
import os |
This file contains 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
#!/usr/bin/env python3 | |
# encoding: utf-8 | |
import smtplib | |
from email.message import Message | |
from email.header import Header | |
from email.utils import formataddr | |
SMTP_SERVER = 'mail.suomi.net' | |
FROM_NAME = 'Example Sender' |
This file contains 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
#!/usr/bin/env python | |
# coding: utf-8 | |
import requests | |
import json | |
import base64 | |
URL_ROOT = "https://postita.fi/api/" | |
PDF_PATH = 'muistutusviesti.pdf' | |
USER = None |
OlderNewer