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
| #!/usr/bin/env python | |
| """ | |
| Do a syn scan over a host. | |
| To run as non-root: | |
| > sudo setcap cap_net_raw=ep /home/michaelc/.virtualenvs/tmp/bin/python2 | |
| Sources: | |
| - http://www.secdev.org/projects/scapy/doc/usage.html | |
| - https://securitylair.wordpress.com/2014/02/21/simple-port-scanner-in-python-with-scapy-2/ |
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
| # Euclidean distance. | |
| def euc_dist(pt1,pt2): | |
| return math.sqrt((pt2[0]-pt1[0])*(pt2[0]-pt1[0])+(pt2[1]-pt1[1])*(pt2[1]-pt1[1])) | |
| def _c(ca,i,j,P,Q): | |
| if ca[i,j] > -1: | |
| return ca[i,j] | |
| elif i == 0 and j == 0: | |
| ca[i,j] = euc_dist(P[0],Q[0]) | |
| elif i > 0 and j == 0: |
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
| package main | |
| import ( | |
| "bytes" | |
| "encoding/hex" | |
| "flag" | |
| "fmt" | |
| "io" | |
| "log" | |
| "net" |
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
| #用正则简单过滤html的<>标签 | |
| import re | |
| str = "<img /><a>srcd</a>hello</br><br/>" | |
| str = re.sub(r'</?\w+[^>]*>','',str) | |
| print str |