E1M1 Posted October 16, 2009 Share Posted October 16, 2009 (edited) I am trying to make simple program that accept firefox.I meant I want display Firefox packets on my script's window.if I accept localhost's port 80 and I type localhost in firefox address bar then firefox should send some packets to localhost.right? now how I can see these packet using autoit? I wanna just make simple program that accept other program's connections. I am just planning to do a simple proxy that works with any program, which means that I have to listen X port from localhost and then I gotta sent these packets to x IP address and then I gotta wait for reply and send packets to program that is connected with my proxy. it's here example from help, with modified port number, but the problem is:When I connect to localhost with firefox I can't see anything on script's window.I need some one's help to turn it into proxy or at least listener that accept random connections. expandcollapse popup#include <GUIConstantsEx.au3> Opt('MustDeclareVars', 1) ;============================================== ;============================================== ;SERVER!! Start Me First !!!!!!!!!!!!!!! ;============================================== ;============================================== Example() Func Example() ; Set Some reusable info ; Set your Public IP address (@IPAddress1) here. ; Local $szServerPC = @ComputerName ; Local $szIPADDRESS = TCPNameToIP($szServerPC) Local $szIPADDRESS = @IPAddress1 Local $nPORT = 80 Local $MainSocket, $GOOEY, $edit, $ConnectedSocket, $szIP_Accepted Local $msg, $recv ; Start The TCP Services ;============================================== TCPStartup() ; Create a Listening "SOCKET". ; Using your IP Address and Port 33891. ;============================================== $MainSocket = TCPListen($szIPADDRESS, $nPORT) ; If the Socket creation fails, exit. If $MainSocket = -1 Then Exit ; Create a GUI for messages ;============================================== $GOOEY = GUICreate("My Server (IP: " & $szIPADDRESS & ")", 300, 200) $edit = GUICtrlCreateEdit("", 10, 10, 280, 180) GUISetState() ; Initialize a variable to represent a connection ;============================================== $ConnectedSocket = -1 ;Wait for and Accept a connection ;============================================== Do $ConnectedSocket = TCPAccept($MainSocket) Until $ConnectedSocket <> -1 ; Get IP of client connecting $szIP_Accepted = SocketToIP($ConnectedSocket) ; GUI Message Loop ;============================================== While 1 $msg = GUIGetMsg() ; GUI Closed ;-------------------- If $msg = $GUI_EVENT_CLOSE Then ExitLoop ; Try to receive (up to) 2048 bytes ;---------------------------------------------------------------- $recv = TCPRecv($ConnectedSocket, 2048) ; If the receive failed with @error then the socket has disconnected ;---------------------------------------------------------------- If @error Then ExitLoop ; Update the edit control with what we have received ;---------------------------------------------------------------- If $recv <> "" Then GUICtrlSetData($edit, _ $szIP_Accepted & " > " & $recv & @CRLF & GUICtrlRead($edit)) WEnd If $ConnectedSocket <> -1 Then TCPCloseSocket($ConnectedSocket) TCPShutdown() EndFunc ;==>Example ; Function to return IP Address from a connected socket. ;---------------------------------------------------------------------- Func SocketToIP($SHOCKET) Local $sockaddr, $aRet $sockaddr = DllStructCreate("short;ushort;uint;char[8]") $aRet = DllCall("Ws2_32.dll", "int", "getpeername", "int", $SHOCKET, _ "ptr", DllStructGetPtr($sockaddr), "int*", DllStructGetSize($sockaddr)) If Not @error And $aRet[0] = 0 Then $aRet = DllCall("Ws2_32.dll", "str", "inet_ntoa", "int", DllStructGetData($sockaddr, 3)) If Not @error Then $aRet = $aRet[0] Else $aRet = 0 EndIf $sockaddr = 0 Return $aRet EndFunc ;==>SocketToIP Edited October 16, 2009 by E1M1 edited Link to comment Share on other sites More sharing options...
E1M1 Posted October 17, 2009 Author Share Posted October 17, 2009 bump edited Link to comment Share on other sites More sharing options...
StandardUser Posted November 7, 2009 Share Posted November 7, 2009 I also would greatly appreciate any help on this. I can even pay for a working script, which also processes https. Any ideas? Link to comment Share on other sites More sharing options...
StandardUser Posted November 9, 2009 Share Posted November 9, 2009 Big bump! Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now