Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9002641
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T00:35:53+00:00 2026-06-16T00:35:53+00:00

Hello I have python sniffer def receiveData(s): data = ” try: data = s.recvfrom(65565)

  • 0

Hello I have python sniffer

def receiveData(s):
    data = ''
    try:
        data = s.recvfrom(65565)
        #k = data.rstrip()
    except timeout:
        data = ''
    except:
        print "An Error Occurred."
        sys.exc_info()
    return data[0]

 data = receiveData(s)

s is socket. Im getting data but it contains symbols please help me somebody how i can convert it into plain text

Im newbie in Python and if its very silly question sorry : )

this is data example E\x00\x00)\x1a*@\x00\x80\x06L\xfd\xc0\xa8\x01\x84\xad\xc2#\xb9M\xb8\x00P\xed\xb3\x19\xd9\xedY\xc1\xfbP\x10\x01\x04\x16=\x00\x00\x00'

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-16T00:35:54+00:00Added an answer on June 16, 2026 at 12:35 am

    You can’t really convert it to “plain text”. Characters such as the NUL (ASCII 0, shown as \x00) can’t be displayed so python shows them in their hex representation.

    What most sniffing/hexdump tools do is to replace unprintable characters with e.g. a dot. You could do it like this:

    import string
    printable = set(string.printable)
    print ''.join(x if x in printable else '.' for x in data)
    

    Example:

    >>> data = 'E\x00\x00)\x1a*@\x00\x80\x06L\xfd\xc0\xa8\x01\x84\xad\xc2#\xb9M\xb8\x00P\xed\xb3\x19\xd9\xedY\xc1\xfbP\x10\x01\x04\x16=\x00\x00\x00'
    >>> print ''.join(x if x in printable else '.' for x in data)
    E..).*@...L.......#.M..P.....Y..P....=...
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have simple python script, 'first.py': #first.py def firstFunctionEver() : print hello firstFunctionEver() I
I have two python modules: a.py import b def hello(): print hello print a.py
I have a simple hello world python script: #!/usr/bin/python print Content-Type: text/html print print
I have a python script called class.py with one line: class.py: print Hello World
I have a python class/object as follows. class Hello: def __init__(self): self.x = None
I have a python script (p.py)with a text like this print Hello+\n print World
hello im new to python and have been reading over the documentation and am
So I have a main.py file inside /home/richard/projects/hello-python directory: import sys sys.path.append('/home/richard/projects/hello-python') from Encode
Hello Guys! I started learning python GUI development. Let's say I have this script:
hello i have question in Python subprocess module I want to interaction with child

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.