Last active
October 4, 2023 04:15
-
-
Save ii64/415459abf39ef931b7bc422ea540feb9 to your computer and use it in GitHub Desktop.
Internet Tepat logs your original URL and use your MSISDN for AD tracking.
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
package main | |
import ( | |
"bytes" | |
"encoding/json" | |
"flag" | |
"fmt" | |
"io" | |
"net/http" | |
"net/http/httputil" | |
"regexp" | |
"time" | |
) | |
var adsReqObjRegExp = regexp.MustCompile(`adsReqObj\s=\s(.*);`) | |
type myTrans struct { | |
p http.RoundTripper | |
} | |
var _ http.RoundTripper = (*myTrans)(nil) | |
func (t *myTrans) RoundTrip(req *http.Request) (resp *http.Response, err error) { | |
resp, err = t.p.RoundTrip(req) | |
if err != nil { | |
return | |
} | |
return | |
} | |
func main() { | |
useStatic := flag.Bool("use-static", false, "Use static") | |
flag.Parse() | |
// **INFO** | |
// Known blackhole portal logger: | |
// - https://internetbaik.telkomsel.com/block?orig_url= | |
// - https://internettepat.telkomsel.com/dns?orig_url= | |
// Use your ISP DNS and let they redirect you to their logger. | |
var url string | |
if *useStatic { | |
url = "https://internettepat.telkomsel.com/dns?orig_url=MY_PRIVACY_GOT_BREACHED&plz-go-to-the-isp-blackhole-portal=1" | |
} else { | |
url = fmt.Sprintf("http://this-domain-does-not-exist%d.com/plz-go-to-the-isp-blackhole-portal/block?orig_url=MY_PRIVACY_GOT_BREACHED!", | |
time.Now().Nanosecond()) | |
} | |
req, err := http.NewRequest(http.MethodGet, url, nil) | |
if err != nil { | |
panic(err) | |
} | |
req.Header = http.Header{ | |
"User-Agent": {"Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/117.0.0.0 Safari/537.36"}, | |
} | |
client := &http.Client{ | |
Transport: &myTrans{http.DefaultTransport}, | |
} | |
resp, err := client.Do(req) | |
if err != nil { | |
panic(err) | |
} | |
if false { | |
bb, _ := httputil.DumpResponse(resp, true) | |
fmt.Printf("%s", string(bb)) | |
} | |
bb, err := io.ReadAll(resp.Body) | |
if err != nil { | |
panic(err) | |
} | |
adsReqObjBufs := adsReqObjRegExp.FindAll(bb, -1) | |
var m map[string]any | |
for i, buf := range adsReqObjBufs { | |
_, buf, _ = bytes.Cut(buf, []byte("=")) | |
buf = bytes.Trim(buf, " ;=") | |
if err := json.NewDecoder(bytes.NewReader(buf)).Decode(&m); err != nil { | |
fmt.Printf("can't decode i=%d: %s\n", i, err) | |
continue | |
} | |
if false { | |
fmt.Printf("i=%d : %+#v\n", i, m) | |
} | |
fmt.Println(m["mdn"]) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment