P0cL4bs / wifipumpkin3

Powerful framework for rogue access point attack.
http://wifipumpkin3.github.io/
Apache License 2.0
1.94k stars 287 forks source link

support system wide / user installation #189

Closed blshkv closed 2 years ago

blshkv commented 2 years ago

Basically, revert https://github.com/P0cL4bs/wifipumpkin3/commit/b082f0d66f8c03c2e9711f3c99c77c562be4403e. That commit broke it.

This is a common problem that many tools which we want to distribute do not support system wide installation. Some of these tools provide their own "install.sh" or "setup.sh" with a distro specific commands (sudo apt-install) to install dependencies instead of a proper setup.py/pyproject.toml (PEP 517). With a proper setup.py script, an end user can install it using the following single command: python3 setup.py install --user. It also a distro friendly and makes life for maintainers easier.

The end result, a FHS compliant directory structure should be created. In case if software produce any output, a local user directory should be used, such as ~./<software>/

There are some custom cases (installing non-python packages, data files etc) which have been resolved in other packages. Bellow, are reference points on such bug reports with solutions (patches) https://github.com/pentoo/pentoo-overlay/issues/596

 * ACCESS DENIED:  mkdir:         /usr/share/wifipumpkin3
Traceback (most recent call last):
  File "/var/tmp/portage/net-wireless/wifipumpkin3-1.1.3_p1/work/wifipumpkin3-1.1.3-R1/setup.py", line 51, in <module>
    create_user_dir_config()
  File "/var/tmp/portage/net-wireless/wifipumpkin3-1.1.3_p1/work/wifipumpkin3-1.1.3-R1/setup.py", line 44, in create_user_dir_config
    os.makedirs(user_config_dir, exist_ok=True)
  File "/usr/lib/python3.9/os.py", line 225, in makedirs
    mkdir(name, mode)
PermissionError: [Errno 13] Permission denied: '/usr/share/wifipumpkin3'
 * ERROR: net-wireless/wifipumpkin3-1.1.3_p1::pentoo failed (compile phase):
blshkv commented 2 years ago

also:

 * QA Notice: setuptools warnings detected:
 * 
 *          Installing 'wifipumpkin3.plugins.pumpkinproxy.tmp' as data is deprecated, please list it in `packages`.
 *          Installing 'wifipumpkin3.plugins.pumpkinproxy.tmp.doc' as data is deprecated, please list it in `packages`.
 *          Installing 'wifipumpkin3.plugins.pumpkinproxy.tmp.exe' as data is deprecated, please list it in `packages`.
 *          Installing 'wifipumpkin3.plugins.pumpkinproxy.tmp.pdf' as data is deprecated, please list it in `packages`.
 *          Installing 'wifipumpkin3.plugins.pumpkinproxy.tmp.xls' as data is deprecated, please list it in `packages`.
mh4x0f commented 2 years ago

This settings is required because the wp3 not should be installed using --user mode because when do this the wp3 will be create a folder on {user}/.config but wp3 require run as super user this change the config to {root}/.config this is a problem for me. make a debian package need to be create a folder on /usr/share/wifipumpkin3 with all files for settings of wp3. as you can see on installation page of wp3 i recommended to install as super user because because wp require super user for run. I can't revert it this is solve make problem with installation of new plugins and solve problem to create a debian package.

mh4x0f commented 2 years ago

my recommendation for you is create a fork of wp3 and do your settings for your system because i only support the debian, i'm only test on debian.

blshkv commented 2 years ago

you are doing it wrong even for debian. NO tools should write anything into system folders such as /usr/share, read up on FHS.

What is the problem with using root/.config?

blshkv commented 2 years ago

I guess for configs and plugins you can use a standard setuptools mechanism: https://github.com/mschwager/fierce/issues/25#issuecomment-360003002 package_dir and packages https://github.com/mschwager/fierce/commit/cf0e41ed38e22f7402b6ba691be7fe15f2a31a9d

blshkv commented 2 years ago

just to be clear, user_config_dir should stay as it was before, all output and user's data should be written there. config_dir should be your packages=[] with system configs, plugins etc

mh4x0f commented 2 years ago

okay, I 'm find a possible solution your problem is install on /usr/share/ and run python3 setup.py install --user correct ? and system-wide, read-only files in /usr

mh4x0f commented 2 years ago

I pushed non draft-configdir a patch for solve this problem check out and send me the feedback.

blshkv commented 2 years ago

ok, I'm testing 1.1.3 R2, and hit an unrelated bug:

 * QA Notice: The ebuild is installing to one or more unexpected paths:
 * 
 *   /usr/wifipumpkin3
 * 
 * Please fix the ebuild to use correct FHS/Gentoo policy paths.

update: The bug should be 'data' related: /usr/wifipumpkin3/data

blshkv commented 2 years ago

https://github.com/P0cL4bs/wifipumpkin3/issues/189#issuecomment-1173005649 That bug is still not fixed. Could you have a look since we are on it?

blshkv commented 2 years ago
sudo -E wifipumpkin3 
/usr/lib/python3.10/site-packages/scapy/layers/ipsec.py:471: CryptographyDeprecationWarning: Blowfish has been deprecated
  cipher=algorithms.Blowfish,
/usr/lib/python3.10/site-packages/scapy/layers/ipsec.py:485: CryptographyDeprecationWarning: CAST5 has been deprecated
  cipher=algorithms.CAST5,
[*] creating config user dir on: /home/blshkv/.config/wifipumpkin3
[+] the user config has been create sucessfully, please restart the wp3!

bash$ sudo -E wifipumpkin3 
/usr/lib/python3.10/site-packages/scapy/layers/ipsec.py:471: CryptographyDeprecationWarning: Blowfish has been deprecated
  cipher=algorithms.Blowfish,
/usr/lib/python3.10/site-packages/scapy/layers/ipsec.py:485: CryptographyDeprecationWarning: CAST5 has been deprecated
  cipher=algorithms.CAST5,
Traceback (most recent call last):
  File "/usr/lib/python-exec/python3.10/wifipumpkin3", line 33, in <module>
    sys.exit(load_entry_point('wifipumpkin3==1.1.3', 'console_scripts', 'wifipumpkin3')())
  File "/usr/lib/python3.10/site-packages/wifipumpkin3/__main__.py", line 86, in main
    config.set("accesspoint", "status_ap", False)
  File "/usr/lib/python3.10/site-packages/wifipumpkin3/core/utility/collection.py", line 47, in set
    self.psettings.beginGroup(name_group)
AttributeError: 'SettingsINI' object has no attribute 'psettings'

it created .config/wifipumpkin3/ directory, but did not copy configs. I copeid it manually from the system path /usr/share/wifipumkin/data/ and it started to work

blshkv commented 2 years ago

ok, thanks for merging my pulls, seems working fine now.

mh4x0f commented 2 years ago

no problem check if work fine now I 'll make a release after that

blshkv commented 2 years ago

yeap, seems fixed. Thanks

mh4x0f commented 2 years ago

great work brow, thanks for support