Get host information for the IP address Check if the IP address is ours or the recipient's TG_OUT := strings.TrimSpace(string(extractOutput)) Log.Fatal("Error extracting IP address:", err) If strings.Contains(string(convertOutput), "STUN 106") ' | awk '!seen++'")ĮxtractOutput, err := extractCmd.Output() Check if Telegram traffic is present in the text file Log.Fatal("Error writing text file:", err)įmt.Println(" Pcap file successfully converted to text.") Log.Fatal("Error converting pcap file to text:", err)Įrr = os.WriteFile(CAP_TEXT, convertOutput, 0644) Convert pcap file to readable text fileĬonvertCmd := exec.Command("tshark", "-r", CAP_PATH)ĬonvertOutput, err := convertCmd.Output() Please wait for", CAP_DURATION, "seconds.")ĬaptureCmd := exec.Command("tshark", "-w", CAP_PATH, "-a", "duration:"+CAP_DURATION)ĬaptureOutput, err := captureCmd.CombinedOutput() Log.Println(" RedHat-based: sudo yum install -y tshark")įmt.Println(" Discovering User's IP Address on Telegram using Golang")įmt.Println(" Starting traffic capture. Log.Println(" Debian-based: sudo apt-get install -y tshark") MY_IP := strings.TrimSpace(string(ipOutput)) Log.Fatal("Failed to get IP address:", err) Get the external IP address of the device Const CAP_PATH = "/tmp/tg_cap.pcap" // Temporary path for pcap capture fileĬonst CAP_TEXT = "/tmp/tg_text.txt" // Temporary path for text file with informationĬonst CAP_DURATION = "5" // Capture duration in seconds
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |