[Evil Server] Unsolved Issues in Exercise

19 months ago by

Hey guys,

I couldn't figure out two things about the exercise:
1. How to send back the string "Hello' world" if the user sends ClipCopy("Hello\' world").
2. How to test (with one computer) that the server can paste onto notepad after opening it with "Run('notepad')" and "ClipPaste".

Have you handles these issues somehow?

Thanks in advance :)

Community: ITC Fellows 16-17

1 Answer

19 months ago by

Hi Ophir :) 

I did not succeed to solve the issue you underline in your second question, I am not sure this would be doable using the same machine for client and server sockets as you need to type the instruction and remove the cursor from the Notepad. But maybe someone else could help us.

For your first question, I think the idea is to find a way to keep escape characters in the string sent between the two sockets.
The issue is that you want your user to type straightly a string, so we have to use "raw_input()" function.

"raw_input" escapes the escape character from the string such as: 

>result_to_print = raw_input('Your input: ')
Your input: : Hello\' world
> result_to_print
"Hello\\' world"

So the string saved in the variable is not exactly the one we typed as escape character are not interpreted but escaped. 

I found a solution to this issue but it is maybe not optimal. 
I used raw_input as it seemed to be the only good solution to read input from user straightly as strings.
Then we receive the string in server where escape characters are escaped.
The idea is to reinterpret escape character in the received strings in order to find the original string.

This can be done using the Python function on string : .decode(string_escaped)
I found the answer using this thread : http://stackoverflow.com/questions/6867588/how-to-convert-escaped-characters-in-python

On my program it seems to work :) 
Let me know if you find the answer for your second question or if there is an issue here ! 


Please login to add an answer/comment or follow this question.

Similar posts:
Search »