#!/usr/bin/env python
import sys
import os
print "Scan a file for ""ErrorScatter"" payload"
print "Drag the suspicious file here then press enter."
filepath = raw_input("File Location: ")
fixpath = filepath , "/Contents/MacOS/ErrorScatter"
scan = os.path.exists(fixpath)
So i am making a program to check if a file has a "ErrorScatter" payload but i keep coming across and error when testing my creation. Since i'm a newb i do not know how to fix this.
This is the error i'm getting:
TypeError: coercing to Unicode: need string or buffer, tuple found
Would anyone know how to fix this?
, operator in Python is used to create tuples, for example
1, 2, 3
makes 3-element tuple
(1, 2, 3)
and
"blah", "bleh"
means 2-element tuple
("blah", "bleh")
To concatenate strings, you could use +
as Gaurav already suggested:
fixpath = filepath + "/Contents/MacOS/ErrorScatter"
but in fact the better way is to
import os
fixpath = os.path.join(filepath, "Contents/MacOS/ErrorScatter")
or even
fixpath = os.path.join(filepath, "Contents", "MacOS", "ErrorScatter")
(using os.path.join
is a habit you will appreciate once you happen to run some scripts on windows, this one is not too likely but habits grow by repetition...)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With