Skip to content

Instantly share code, notes, and snippets.

@optman
optman / tproxy.c
Last active August 25, 2016 06:42
test tproxy
#include <stdio.h>
#include <sys/types.h> /* See NOTES */
#include <sys/socket.h>
#include <netinet/in.h>
#include <netinet/ip.h>
#include <errno.h>
#include <string.h>
#include <arpa/inet.h>
int main(){
package main
import (
"errors"
"net"
"strconv"
"syscall"
"unsafe"
"os"
)
@optman
optman / token.py
Created December 8, 2015 03:41
baofeng cloud token
import hmac
import hashlib
import base64
def create_token(msg, accessKey, secretKey):
encodedMsg = base64.b64encode(bytearray(msg,"utf-8"))
sign = hmac.new(bytearray(secretKey,"utf-8"), msg=encodedMsg,
digestmod=hashlib.sha1).digest()
encodedSign =base64.b64encode(sign)
Request URL:https://manifest.googlevideo.com/api/manifest/dash/key/yt6/ip/106.184.6.201/signature/8A3AC35F67578946CD7A4A80FD3949F803999F8D.8BBE7DA646F82DDF07A17BF7A520A86029283042/itag/0/source/yt_live_broadcast/ipbits/0/expire/1450773907/sver/3/fexp/3300131%2C3300137%2C3300164%2C3312381%2C9416126%2C9417224%2C9419542%2C9420311%2C9420452%2C9422596%2C9423662/as/fmp4_audio_clear%2Cfmp4_sd_hd_clear/sparams/cwbhb%2Cgcr%2Chfr%2Cid%2Cip%2Cipbits%2Citag%2Cplaylist_type%2Cpmbypass%2Csource%2Cexpire/hfr/1/playlist_type/DVR/pmbypass/yes/gcr/jp/upn/Bdru75oBJJw/cwbhb/yes/id/Bq7NbbuHkyA.1?cpn=VNz7nhgOLr04JNqQ&mpd_version=3&start_seq=943
Request Method:GET
Status Code:200 OK
Remote Address:216.58.220.238:443
Response Headers
access-control-allow-credentials:true
access-control-allow-origin:https://gaming.youtube.com
access-control-expose-headers:Client-Protocol, Content-Length, Content-Type
alt-svc:quic=":443"; ma=604800; v="30,29,28,27,26,25"
alternate-protocol:443:quic,p=1
ssh -x [email protected] tcpdump 'not tcp port 22' -i any -s0 -U -w - | wireshark -k -i -
#nbtscan 192.168.199.0/24
Doing NBT name scan for addresses from 192.168.199.0/24
IP address NetBIOS Name Server User MAC address
------------------------------------------------------------------------------
192.168.199.0 Sendto failed: Permission denied
192.168.199.1 OPENWRT <server> OPENWRT 00:00:00:00:00:00
192.168.199.3 UBUNTU <server> UBUNTU 00:00:00:00:00:00
192.168.199.161 HUANGHAIQUAN-PC <server> <unknown> xx:xx:xx:xx:xx:xx
$ sudo netstat -tnop
Active Internet connections (w/o servers)
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name Timer
tcp 0 0 192.168.1.4:8080 192.168.1.15:41336 FIN_WAIT2 14470/6 off (0.00/0/0)
tcp 0 0 192.168.1.4:1122 192.168.1.15:55123 ESTABLISHED 14370/0 off (0.00/0/0)
tcp 0 0 192.168.1.4:8080 10.0.0.103:46497 FIN_WAIT2 14470/6 off (0.00/0/0)
tcp 0 0 192.168.1.4:8080 192.168.1.15:41631 FIN_WAIT2 14470/6 off (0.00/0/0)
tcp 0 0 192.168.1.4:22 111.206.27.194:15923 ESTABLISHED 14415/sshd: pi [pri keepalive (2877.14/0/0)
tcp 0 0 192.168.1.4:8080 192.168.1.15:41633 FIN_WAIT2 14470/6 off (0.00/0/0)
tcp 0 0 192.168.1.4:8080 10.0.0.103:46495 FIN_WAIT2 14470/6 off (0.00/0/0)
@optman
optman / ntpdate
Created April 14, 2016 06:23
ntpdate -s time.nist.gov
ntpdate -s time.nist.gov
$ tracepath www.google.com -n
1?: [LOCALHOST] pmtu 1500
1: 192.168.199.1 0.752ms
1: 192.168.199.1 0.715ms
2: 192.168.199.1 0.701ms pmtu 1416
2: 10.7.0.1 7.442ms
3: 10.9.0.1 185.643ms
4: 103.3.60.3 182.656ms
5: 139.162.0.13 186.270ms
6: 139.162.0.18 184.851ms asymm 5
~# ipset list china | head -n 20
Name: china
Type: hash:net
Revision: 6
Header: family inet hashsize 1024 maxelem 65536
Size in memory: 57656
References: 1
Members:
203.56.228.0/24
203.99.80.0/20