Skip to content

Question Around Response Port #577

Answered by ninp0
ninp0 asked this question in Q&A
Discussion options

You must be logged in to vote

I'm sure there's a better way to do this but here's what I came up with:

def get_resp(target, fuzz_data_logger, session, sock, *args, **kwargs):
  last_resp_bytes = ''
  resp_socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM)

  try:
    resp_socket.bind(('0.0.0.0', response_port))
    resp_socket.listen(1)
    conn, addr = resp_socket.accept()

    print('Connection from: ' + str(addr))
    while True:
      resp = str(conn.recv(1024).decode())
      if not resp:
        break

      full_resp = last_resp_bytes + resp

  except:
    print 'resp_socket initialization failed'
  finally:
    resp_socket.close
    fuzz_data_logger.log_recv(full_resp)

    test_case_desc = (
      'Fu…

Replies: 3 comments

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Answer selected by SR4ven
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants
Converted from issue

This discussion was converted from issue #182 on December 04, 2021 22:49.