Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #52639 > unrolled thread
| Started by | "D. Xenakis" <gouzounakis@hotmail.com> |
|---|---|
| First post | 2013-08-17 13:23 -0700 |
| Last post | 2013-08-18 19:24 -0400 |
| Articles | 5 — 3 participants |
Back to article view | Back to comp.lang.python
log incoming ip/porrt connections "D. Xenakis" <gouzounakis@hotmail.com> - 2013-08-17 13:23 -0700
Re: log incoming ip/porrt connections "D. Xenakis" <gouzounakis@hotmail.com> - 2013-08-17 13:35 -0700
Re: log incoming ip/porrt connections Irmen de Jong <irmen.NOSPAM@xs4all.nl> - 2013-08-18 00:43 +0200
Re: log incoming ip/porrt connections "D. Xenakis" <gouzounakis@hotmail.com> - 2013-08-18 13:41 -0700
Re: log incoming ip/porrt connections Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2013-08-18 19:24 -0400
| From | "D. Xenakis" <gouzounakis@hotmail.com> |
|---|---|
| Date | 2013-08-17 13:23 -0700 |
| Subject | log incoming ip/porrt connections |
| Message-ID | <be221609-53d8-4fba-998b-ad638833aa14@googlegroups.com> |
Hi there. I have a script-service running on a remote server, listening on a specific port. What i need here is to make this also maintain a log file of ALL incoming connections. Could someone suggest to me a simple codefunction example to implement that on my main running service? THX!!
[toc] | [next] | [standalone]
| From | "D. Xenakis" <gouzounakis@hotmail.com> |
|---|---|
| Date | 2013-08-17 13:35 -0700 |
| Message-ID | <6afa0547-91c7-4a3c-aa45-346ff440f239@googlegroups.com> |
| In reply to | #52639 |
Or point me the right way in case this is not that simple to do.
[toc] | [prev] | [next] | [standalone]
| From | Irmen de Jong <irmen.NOSPAM@xs4all.nl> |
|---|---|
| Date | 2013-08-18 00:43 +0200 |
| Message-ID | <520ffca0$0$15945$e4fe514c@news.xs4all.nl> |
| In reply to | #52639 |
On 17-8-2013 22:23, D. Xenakis wrote:
> Hi there. I have a script-service running on a remote server, listening on a specific port. What i need here is to make this also maintain a log file of ALL incoming connections.
>
> Could someone suggest to me a simple codefunction example to implement that on my main running service?
>
> THX!!
>
One approach could be simply to log the client socket's peername to a logfile, something
like this:
import logging
log=logging.getLogger("connections")
...
if <<new connection>>:
clientsocket = ...
log.debug("new connection from "+clientsocket.getpeername())
...
Irmen
[toc] | [prev] | [next] | [standalone]
| From | "D. Xenakis" <gouzounakis@hotmail.com> |
|---|---|
| Date | 2013-08-18 13:41 -0700 |
| Message-ID | <746d9a4e-b643-447c-b4bb-a2aa4e8f2d95@googlegroups.com> |
| In reply to | #52643 |
This monitors also ip/port of incoming udp packets? Or just tcp after a connection has been enstablished? If i dont make any sense, plz correct me. Not much experience with networking here :)
[toc] | [prev] | [next] | [standalone]
| From | Dennis Lee Bieber <wlfraed@ix.netcom.com> |
|---|---|
| Date | 2013-08-18 19:24 -0400 |
| Message-ID | <mailman.8.1376868276.19984.python-list@python.org> |
| In reply to | #52661 |
On Sun, 18 Aug 2013 13:41:32 -0700 (PDT), "D. Xenakis"
<gouzounakis@hotmail.com> declaimed the following:
>This monitors also ip/port of incoming udp packets?
>Or just tcp after a connection has been enstablished?
>If i dont make any sense, plz correct me. Not much experience with networking here :)
It begins to sound like you want some of the capability of Wireshark...
In that case you'll want to obtain the PCAP libraries (included with
Wireshark on Windows) AND the PCAP Python module. Warning, you may need to
run in Admin mode to be able to snoop the NIC...
--
Wulfraed Dennis Lee Bieber AF6VN
wlfraed@ix.netcom.com HTTP://wlfraed.home.netcom.com/
[toc] | [prev] | [standalone]
Back to top | Article view | comp.lang.python
csiph-web