0

Code: Parsing some data from an XML file as , taking user input and trying to replace a sub-string in the text parsed from the XML file. (This is for a upcoming HID attack framework https://github.com/SkiddieTech/HIDAAF, part of my offensive computer security degree)

def Generate_Payload(payload):
      print " Selection : " , payload
      import xml.etree.ElementTree as ET
      payload_raw = ET.parse(payload).getroot().find('payload').text                
      print payload_raw
      shell_name = input("Please enter the name of your malicious apk :")                   
      payload_raw_filtered = payload_raw.replace('#APKNAME#', shell_name)                   
      print payload_raw_filtered
      os.system('pause')

Error:

           Please enter the name of your malsivus apk :apk
            Traceback (most recent call last):
              File "C:\Users\Master\Documents\GitHub\HIDAAF\hidaaf.py", line 52, in <module>
                List_Payloads()
              File "C:\Users\Master\Documents\GitHub\HIDAAF\hidaaf.py", line 41, in List_Payloads
                Generate_Payload(filenames[payload - 1 ])
              File "C:\Users\Master\Documents\GitHub\HIDAAF\hidaaf.py", line 18, in Generate_Payload
                shell_name= input("Please enter the name of your malicious apk :")
              File "<string>", line 1, in <module>
            NameError: name 'apk' is not defined

1 Answer 1

1

You are probably using python 2. Use raw_input instead of input.

input is for entering actual python code, so it's complaining that the variable with name apk is not defined.

This is not the case in python 3.

Sign up to request clarification or add additional context in comments.

3 Comments

Thank you! Is the current Phy2 already outdate? Should i be porting this to Phy3?
Yes. Use python 3 so your code will be relevant in 2 years.
FYI: Python 2 is EOL in 2020 and will no longer be maintained.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.