Skip to content

Instantly share code, notes, and snippets.

View rohan-molloy's full-sized avatar

Rohan rohan-molloy

View GitHub Profile
#!/bin/sh
RESPONSE=`curl -s -X GET http://hi.link/api/webserver/SesTokInfo`
COOKIE=`echo "$RESPONSE"| grep SessionID=| cut -b 10-147`
TOKEN=`echo "$RESPONSE"| grep TokInfo| cut -b 10-41`
DATA="<request><PageIndex>1</PageIndex><ReadCount>3</ReadCount><BoxType>1</BoxType><SortType>0</SortType><Ascending>0</Ascending><UnreadPreferred>1</UnreadPreferred></request>"
curl -b $COOKIE -c $COOKIE -H "X-Requested-With: XMLHttpRequest" --data "$DATA" http://hi.link/api/sms/sms-list --header "__RequestVerificationToken: $TOKEN" --header "Content-Type:text/xml"
@rohan-molloy
rohan-molloy / dns.md
Last active June 18, 2017 18:09
Forcing all vpn clients to use a particular dns

Hijacking dns traffic with iptables nat

We put this on the vpn server (which functions much like a home router, doing NAT and dns resolving)

  iptables -t nat -A PREROUTING -i tun0 -p udp -m udp --dport 53 ! -d 10.53.1.53 -j DNAT --to-destination 10.53.1.53
  iptables -t nat -A PREROUTING -i tun0 -p tcp -m tcp --dport 53 ! -d 10.53.1.53 -j DNAT --to-destination 10.53.1.53

So for connections entering via tun0 (the internal side), that leave to an external destination on the DNS,

we redirect them to our dns server (10.53.1.53), although we could pick an external server if we wanted to.

3.141592653589793238462643383279
5028841971693993751058209749445923
07816406286208998628034825342117067
9821 48086 5132
823 06647 09384
46 09550 58223
17 25359 4081
2848 1117
4502 8410
2701 9385

Rsyslog.conf

provides support for local system logging

$ModLoad imuxsock 

provides kernel logging support

$ModLoad imklog   
server.socket = "0.0.0.0:443"
server.username = "www-data"
server.groupname = "www-data"
server.modules = (
"mod_proxy",
"mod_access",
"mod_compress",
)
ssl.dh-file = "/etc/lighttpd/dh2048.pem"
ssl.ec-curve = "secp384r1"
alias Escape-HTML="sed 's/&/\&amp;/g; s/</\&lt;/g; s/>/\&gt;/g; s/"/\&quot;/g; s/'"'"'/\&#39;/g'; s/' '/&nbsp;/ | sed ':begin;$!N;s/\n/<br \/>/;tbegin'"
`-:+ossyyyysso+:-`
./osssssssssssssssssyo/.
:osssssssssssssssssssssssso:
-osssssssssssssssssssssssssssss:
+ssssssssssssso++++ossssssssssssso`
`osssssssssso:. .:osssssssssss`
+ssssssssso- `````` .ossssssssso
-sssssssss+ `........` /sssssssss:
+sssssssss `...........` osssssssss
awk {'print "local-data: \""$2" IN A "$1"\nlocal-data ptr: \""$1" "$2"\""}' <(grep -v ^# /etc/hosts | grep -v localhost) | grep -v 'local-data: " IN A ' | grep -v 'local-data ptr: " "
'
curl --silent https://raw.githubusercontent.com/StevenBlack/hosts/master/hosts | grep '^0\.0\.0\.0' | awk '{print "local-zone: \""$2"\" refuse"}' | sort
SOCKSPort 9050
TransPort 9040
VirtualAddrNetworkIPv4 10.192.0.0/10
AutomapHostsOnResolve 1
DNSPort 5353