-
-
Save tgr420/91f66f1ab531a7f8b689df7f5fad9eef to your computer and use it in GitHub Desktop.
IPv6 Golang bypass
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 ( | |
| "log" | |
| "net" | |
| "net/url" | |
| ) | |
| func main() { | |
| input := "http%3A%2F%2F::ffff:a9fe:a9fe:0443" | |
| // Parse the URL | |
| decodedURL, err := url.QueryUnescape(input) | |
| if err != nil { | |
| log.Fatalf("Failed to decode URL: %v", err) | |
| } | |
| log.Println("Decoded URL:", decodedURL) | |
| parsedURL, err := url.Parse(decodedURL) | |
| if err != nil { | |
| log.Fatalf("Failed to parse URL: %v", err) | |
| } | |
| log.Println("Parsed URL:", parsedURL) | |
| // Resolve DNS | |
| ips, err := net.LookupIP(parsedURL.Host) | |
| if err != nil { | |
| log.Fatalf("DNS lookup failed: %v", err) | |
| } | |
| // Check first resolved IP | |
| if len(ips) > 0 { | |
| ip := ips[0] | |
| log.Printf("Resolved IP: %v\n", ip) | |
| // Check if private | |
| if ip.IsPrivate() { | |
| log.Println("IP is private") | |
| } else { | |
| log.Println("IP is public") | |
| } | |
| } else { | |
| log.Println("No IPs resolved") | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment