Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

module import error #8

Closed
vck opened this issue May 19, 2015 · 8 comments
Closed

module import error #8

vck opened this issue May 19, 2015 · 8 comments

Comments

@vck
Copy link

vck commented May 19, 2015

hey there,
when i run the framework.py it says

Traceback (most recent call last):
  File "framework.py", line 7, in <module>
    from src.core import *
ImportError: No module named src.core

instead using from src.core import * why don't you just use from core import * ?
after change the import section into from core import * it's runs like what i thought

@trustedsec
Copy link
Collaborator

Not sure why that would be an issue, did you check out PTF from github? On a fresh install it works fine since we are doing a direct relative import from the src folder and core directory. Everything works fine from a fresh install - not sure what you would be experiencing there as traditional import is supported in both python 2.7 and 3.

Changing import to from core import * wouldn't be a valid import as it doesn't know where core is located for the import. Not sure how or why that would work on your system...

Closing this issue as I cannot reproduce on Ubuntu, Kali, or Debian test beds.

root@kali:# git clone https://github.com/trustedsec/ptf
Cloning into 'ptf'...
remote: Counting objects: 139, done.
remote: Compressing objects: 100% (81/81), done.
remote: Total 139 (delta 81), reused 108 (delta 50), pack-reused 0
Receiving objects: 100% (139/139), 25.26 KiB, done.
Resolving deltas: 100% (81/81), done.
root@kali:
# cd ptf
root@kali:/ptf#
root@kali:
/ptf# ./ptf
[*] Trying to update myself first.. Then starting framework.
Already up-to-date.

@vck
Copy link
Author

vck commented May 19, 2015

yes, i've clone the repo, into my dev dir,
i'm currently using python 2.7.x, and the interpreter seemed to be bad for my system,
i am a native Python coder, and i know how to use the intepreter, especially in *nix like environment, but your codes doesn't has a good interpreter, i'm so sorry, but why are you using #!/usr/local/python instead of #!/usr/bin/env/python?

well,

bash: ./ptf: /usr/local/python: bad interpreter: No such file or directory

and after change the interpreter into #!/usr/bin/python it's works pretty well

@trustedsec
Copy link
Collaborator

Git pull the latest repo, this was fixed already.

@vck
Copy link
Author

vck commented May 19, 2015

OK

@trustedsec
Copy link
Collaborator

framework.py is a library - you should just be running ./ptf or python ptf. Not directly running the core modules independently. This is a hierarchy structure for coding.

@vck
Copy link
Author

vck commented May 19, 2015

yeah, i know it.
uhmm, after tested your tool, i realized that some function requires root previllage,

like errors bellow:

[*] Tool not installed yet, will run through install routine
[*] Preparing dependencies for module: modules/intelligence-gathering/recon-ng
E: Could not open lock file /var/lib/dpkg/lock - open (13: Permission denied)
E: Unable to lock the administration directory (/var/lib/dpkg/), are you root?
[*] Pre-reqs for modules/intelligence-gathering/recon-ng have been installed.
[*] Making the appropriate directory structure first
mkdir: cannot create directory ‘/pentest’: Permission denied
[*] GIT was the selected method for installation... Using GIT to install.
fatal: could not create leading directories of '/pentest/intelligence-gathering/recon-ng': Permission denied

some users may not concern about it, how about they didn't use Kali? like Ubuntu/Debian, not all users log in to their system with root user defaulty. compared to Kali users, i think you need to
add some warning to it (the ptf),

like :

if os.getuid() != 0:
    print "[!] Previllage access needed!! \n[!] Must run as root!!!"
    sys.exit()

@trustedsec
Copy link
Collaborator

I would agree with you, having a root check is a great idea. Something I added into SET but didn't into here. Will add that now and appreciate it!

@vck
Copy link
Author

vck commented May 20, 2015

and, like what Metasploit does, the ptf should be able to run some shell command, like ifconfig,whoami, etc, it would be nicer if you add this capability to the ptf

trustedsec pushed a commit that referenced this issue Jan 9, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant