Skip to content

Instantly share code, notes, and snippets.

View anch0vy's full-sized avatar
😸
Working from home

anch0vy anch0vy

😸
Working from home
View GitHub Profile
import socket
import StringIO
import struct
from struct import pack
def make_packet(bf,ori):
len_ori=len(ori)
if len(ori)%8!=0:
ori=ori+'\x00'*(8-len(ori)%8)
encoded=bf.encode(ori)
len_enc=len(encoded)
import socket
import os
s = socket.socket(socket.AF_INET, socket.SOCK_RAW, socket.IPPROTO_TCP)
if os.name=='nt':
HOST = socket.gethostbyname(socket.gethostname())
s.bind((HOST, 0))
s.setsockopt(socket.IPPROTO_IP, socket.IP_HDRINCL, 1)
s.ioctl(socket.SIO_RCVALL, socket.RCVALL_ON)
while True:
RawPacketData,(ip,port)=s.recvfrom(65565)
try:
1/0
finally:
print 'in finally'
def life():
try:
return 'egg'#삶은계란
finally:
return 42#the answer to life the universe and everything
import sys
import math
if __name__=='__main__':
for x in sys.argv[1:]:
counts=[0]*256
entropy=0
with open(x,'rb') as f:
fr=f.read()
for xx in fr:
counts[ord(xx)]+=1
pip install pyinstaller
pyinstaller-script.py -F myscript.py
f=open('myfile')
print os.fstat(f.fileno()).st_size
def wtf(r):
global dontknow_table
for x in range(len(dontknow_table)):
dontknow_table[x]^=xor_table[r]
r3=0x0
while 1:
r7 = [input[r3:r3+2][::-1] - 0x3332][::-1]
r7 = ~r7
@anch0vy
anch0vy / ch0vycoin.py
Created August 5, 2015 08:08
ch0vycoin
# -*- coding: utf-8 -*-
import time
import pickle
import struct
from math import log,e
from hashlib import md5
startBlock = 'cat'
def mine(block,diff):
@anch0vy
anch0vy / ssh_test.py
Last active September 8, 2015 11:35
ssh test
import paramiko
import code
ssh = paramiko.SSHClient()
ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy())
ssh.connect('localhost', username='root', password='password', port = 22)
stdin, stdout, stderr = ssh.exec_command('ls -al')
print 'ls -al test 1'
print stdout.read()
ch = ssh.invoke_shell()