python - Getting ESC characters and non-printables from UDP socket / buffer -


i've got custom script listening on port 161 udp packets come in. listens fine, receives string fine - , when send message test script (on box), displays fine in log, etc.

i'm gathering udp data follows:

data, addr = sock.recvfrom(1024) 

data contains string information need.

when performing tcpdump on interface data coming in, looks normal, such as:

.1.3.6.1.4.1.3375.2.1.1.2.12.6 .1.3.6.1.4.1.3375.2.1.1.2.12.6 public "this trap" .1.3.6.1.4.1.3375.2.1.1.2.12.6 .1.3.6.1.4.1.3375.2.1.1.2.12.6 

when take incoming data (in python) , print it, or output file, bunch of esc sequences, or otherwise unprintable data in log file.

everything inside of quote preserved.

i've been able strip out esc sequences , store 'good stuff' inside of quotes, i'm losing oid's. it's if python thinks ascii characters else.

i did notice when trying save garbled data, if change encoding latin-1 -- becomes readable...but still there's garbled characters in there.

i've tried duplicate matter here @ home - no matter text feed through test.py listener on port 161, comes out fine , readable. implemented in test environment @ work. ps not programmer, network guy.

if matters, device sending snmp traps out f5 ltm. know pretty general question, appreciate taking time read question in entirety , spend few minutes thinking it.


Comments

Popular posts from this blog

What is happening when Matlab is starting a "parallel pool"? -

angular - DownloadURL return null in below code -

php - Cannot override Laravel Spark authentication with own implementation -