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/python | |
# a simple udp server | |
import socket, traceback | |
s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) | |
s.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1) | |
s.bind(("127.0.0.1",12345)) | |
while 1: | |
try: |
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/python | |
import nmap | |
# python-nmap url : http://xael.org/norman/python/python-nmap/python-nmap-0.1.4.tar.gz | |
nm = nmap.PortScanner() | |
nm.scan(hosts='192.168.1.0/24', arguments='-n -p 161 -sU ') | |
hosts_list = [(x, nm[x][u'udp'][161]['state']) for x in nm.all_hosts()] | |
#print nm.all_hosts() | |
#print nm[u'192.168.1.100'][u'udp'][161]['state'] |
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 paramiko | |
hostname = '192.168.1.1' | |
port = 22 | |
username = 'foo' | |
password = 'xxxYYYxxx' | |
if __name__ == "__main__": |
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 -*- | |
""" | |
compare so files funcs | |
test pass : centos6.4_x64 | |
e-mail : mike_zhang@live.com | |
""" | |
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/python | |
import smtplib,re,urllib2,time | |
import socket | |
from subprocess import Popen, PIPE | |
smtpServer='smtp.163.com' | |
smtpPort='25' | |
sender = 'XXXXX@163.com' | |
senderPasswd = "XXXXX" |
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/python | |
import os | |
dir1 = "essays" | |
dir2 = "../tmp" | |
tmpBranchName = "other" | |
execCommand = os.system |
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 | |
# http://musta.sh/2012-03-04/twisted-tcp-proxy.html | |
import sys | |
from twisted.internet import defer | |
from twisted.internet import protocol | |
from twisted.internet import reactor | |
from twisted.python import log |
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
启动: | |
VBoxManage startvm CentOS6.3_64 -type vrdp | |
vbs代码: | |
Set ws = CreateObject("Wscript.Shell") | |
ws.run "cmd /c VBoxManage startvm CentOS6.3_64 -type vrdp",vbhide | |
休眠: | |
VBoxManage controlvm CentOS6.3_64 savestate |
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
# just in windows | |
import os | |
var = os.popen("wmic nicconfig get MACAddress").read() | |
#print var | |
macList = [] | |
for x in var.split(" \r\n"): | |
if len(x.strip()) > 0 and x.find("MACAddress"): | |
if x not in macList:macList.append(x) |
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
''' | |
fileName : build.py | |
usage : build.py py2exe | |
''' | |
from distutils.core import setup | |
import py2exe | |
import sys | |
includes = ["encodings", "encodings.*"] | |
sys.argv.append("py2exe") |