social-engineer-toolkit icon indicating copy to clipboard operation
social-engineer-toolkit copied to clipboard

[!] Something went wrong, printing the error: name 'file' is not defined

Open csharshtiwari opened this issue 6 years ago • 6 comments

Expected Behaviour

Put here what the expected behaviour should be when reporting an issue

Actual Behaviour

Put here what the actual behaviour should be when reporting an issue

Set Version

Set version

Before opening an issue please make sure you are running the most up to date version of set

We see the same bug reports being opened for issues that have already been fixed in a new release

Set in Kali

Please make sure you are running kali-rolling and your system is up to date. To update your system do the following apt update && apt full-upgrade

Run the following to check your version of Kali lsb_release -rdc and you should see the following output

Description:	Kali GNU/Linux Rolling
Release:	kali-rolling
Codename:	kali-rolling

If you do not see the following output download the ISO from http://cdimage.kali.org/kali-images/kali-weekly/

If you do all of the above and still have an issue then please open a issue.

csharshtiwari avatar Jan 27 '20 15:01 csharshtiwari

Hello, I've got this issue, andI had this: oot @ kali: ~ # lsb_release -rdc Description: Kali GNU / Linux Rolling Release: 2019.4 Code me: Kali-Rolling after doing the update I get: apt update && apt full-upgrade and restart pc, root @ kali: ~ # lsb_release -rdc Description: Kali GNU / Linux Rolling Release: 2019.4 Code me: Kali-Rolling and the error persist. what to do? thanks.

sindikto avatar Jan 27 '20 17:01 sindikto

sorry I've got an error, this is the result: lsb_release -rdc Description: Kali GNU/Linux Rolling Release: 2020.1 Codename: kali-rolling

sindikto avatar Jan 27 '20 17:01 sindikto

i had this error with the site cloner. if you go to the main page on here for SET and download the files, extract and then copy them into the /usr/share/set directory it should resolve the issue.

wdmarauder avatar Jan 27 '20 18:01 wdmarauder

In order to find the error, the best way is to go to the same directory where you have it installed, and open the "setoolkit" file with your favorite text editor, go to the final of the file, and comment the "except Exception as error" in order to let you get the root cause. You must have the "setoolkit" file like this:

# handle exceptions
#except Exception as error:
#    core.log(error)
#    print("\n\n[!] Something went wrong, printing the error: " + str(error))

So, then, if you launch again the toolkit, you will see the following error:

Traceback (most recent call last):
  File "./setoolkit", line 245, in <module>
    import src.core.set
  File "/opt/tools/other/set/src/core/set.py", line 606, in <module>
    import harvester
  File "/opt/tools/other/set/src/webattack/harvester/harvester.py", line 57, in <module>
    filewrite = file("%s/src/logs/harvester.log" % (os.getcwd()), "w")
NameError: name 'file' is not defined

And here, you could see that the problem is when setoolkit tries to open for writing the file "%s/src/logs/harvester.log" and it does not exist, so... you just need to execute the following:

$ cd /path/of/your/set/installation $ touch src/logs/harvester.log

zprian avatar Jan 30 '20 23:01 zprian

In order to find the error, the best way is to go to the same directory where you have it installed, and open the "setoolkit" file with your favorite text editor, go to the final of the file, and comment the "except Exception as error" in order to let you get the root cause. You must have the "setoolkit" file like this:

# handle exceptions
#except Exception as error:
#    core.log(error)
#    print("\n\n[!] Something went wrong, printing the error: " + str(error))

So, then, if you launch again the toolkit, you will see the following error:

Traceback (most recent call last):
  File "./setoolkit", line 245, in <module>
    import src.core.set
  File "/opt/tools/other/set/src/core/set.py", line 606, in <module>
    import harvester
  File "/opt/tools/other/set/src/webattack/harvester/harvester.py", line 57, in <module>
    filewrite = file("%s/src/logs/harvester.log" % (os.getcwd()), "w")
NameError: name 'file' is not defined

And here, you could see that the problem is when setoolkit tries to open for writing the file "%s/src/logs/harvester.log" and it does not exist, so... you just need to execute the following:

$ cd /path/of/your/set/installation $ touch src/logs/harvester.log

This worked for me. Thanks!

AMetz-InfosecGuy avatar Feb 03 '20 11:02 AMetz-InfosecGuy

I'll be pushing an update here soon, fixed in 8.0.2

ghost avatar Feb 03 '20 22:02 ghost