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 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) |
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 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) |
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
| try: | |
| 1/0 | |
| finally: | |
| print 'in finally' |
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
| def life(): | |
| try: | |
| return 'egg'#삶은계란 | |
| finally: | |
| return 42#the answer to life the universe and everything |
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 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 |
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
| pip install pyinstaller | |
| pyinstaller-script.py -F myscript.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
| f=open('myfile') | |
| print os.fstat(f.fileno()).st_size |
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
| 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 |
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
| # -*- coding: utf-8 -*- | |
| import time | |
| import pickle | |
| import struct | |
| from math import log,e | |
| from hashlib import md5 | |
| startBlock = 'cat' | |
| def mine(block,diff): |
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 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() |
OlderNewer