Skip to content

Commit

Permalink
Support Windows (#33)
Browse files Browse the repository at this point in the history
* pyinstaller for windows

* Revert pyqtdeploy to v2

* pylinter

Co-authored-by: rllola <[email protected]>
  • Loading branch information
stoned-newton and rllola authored Mar 11, 2021
1 parent ea14f5d commit 9a15cfa
Show file tree
Hide file tree
Showing 17 changed files with 617 additions and 30 deletions.
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,8 @@ pkg-debian/usr/share/
*.tar.xz
sysroot-*
build-*
*.zip
.vs
*.pyo
*.exe
idea.txt
15 changes: 15 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": "Python : Fichier actuel",
"type": "python",
"request": "launch",
"program": "${file}",
"console": "integratedTerminal"
}
]
}
92 changes: 90 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,16 +16,91 @@ Here : Mi Home Security Camera 360° 1080P by Xiaomi.

Call it `venv` really important!

#### Linux

```
$ virtualenv venv -p $(which python3.7) --always-copy
$ source venv\bin\activate
$ source venv/bin/activate
```

You will also need to give special permission to use scapy newtorks feature.
```
$ setcap cap_net_raw=eip venv/bin/python
```

And install python dependecies.
```
$ pip install -r requirements.txt
```

#### Windows

```
$ virtualenv venv
$ .\venv\Script\activate
```

For windows you will need Npcap : https://nmap.org/npcap/

And install python dependecies.
```
$ pip install -r requirements.txt
```

## Build

### Windows

Windows use (PyInstaller)[http://www.pyinstaller.org/] to build the Airbnb Camera Scanner.
```
$ pip install pyinstaller
```

Build command:
```
$ pyinstaller airbnb-scanner.spec
```

The working executable is in the `dist` folder and called `AirbnbScanner.exe`.

You can now create an installer for Windows.
You will need to install NSIS software : https://nsis.sourceforge.io/Download
In your favorite PowerShell terminal :
```
$ $tag = "v0.0.0"
$ $size = [math]::floor((Get-ChildItem dist\ -Recurse | Measure-Object -Sum Length | Select-Object -ExpandProperty Sum)/1000)
$ $major, $minor, $build = $tag.substring(1).split(".")
$ & 'C:\Program Files (x86)\NSIS\Bin\makensis.exe' /DTAG=$tag /DSIZE=$size /DMAJOR=$major /DMINOR=$minor /DBUILD=$build zeronetbrowser.nsi
```

### Linux

!!!Important!!!
We stick pyqtdeploy 2.5.1 and wil upgrade to 3.1 later. Still having some issue.

Linux use (PyQtDeploy)[https://www.riverbankcomputing.com/static/Docs/pyqtdeploy/] to build the Airbnb Camera Scanner.

```
$ pip install pyqtdeploy==2.5.1
$ make patches
```
This version need to be patches to succefully build the project.

Download the sources files to be compiled.
```
$ make download
```

Create sysroot folder.
```
$ make init
```

Build.
```
$ make build
```

## Notes

### Scapy root privileges needed
Expand All @@ -44,6 +119,8 @@ But also we need `$XDG_RUNTIME_DIR` to match the user folder so no root to see t

### Packaging with pyqtdeploy

You will probably need all this dependencies (https://doc.qt.io/qt-5/linux-requirements.html).

Error :
```
_ctypes.c:107:10: fatal error: ffi.h: No such file or directory
Expand Down Expand Up @@ -72,7 +149,18 @@ Requires `libssl1.1` for the latest version.

----

### [Windows] Install npcap

Error:
```
RuntimeError: Sniffing and sending packets is not available at layer 2: winpcap is not installed. You may use conf.L3socket orconf.L3socket6 to access layer 3
```

https://nmap.org/npcap/


### Acknowledgment

Reload icon by [Gregor Cresnar](https://www.flaticon.com/authors/gregor-cresnar).
Warning icon by [Kit of Parts](http://kitofparts.co/)
Warning icon by [Kit of Parts](http://kitofparts.co/).
B. for testing Windows build.
177 changes: 177 additions & 0 deletions airbnb-scanner.pdt
Original file line number Diff line number Diff line change
@@ -0,0 +1,177 @@
version = 0
sysroot = ""
sysroots_dir = ""
parts = [ "Python:sysconfig", "Python:zlib", "PyQt:PyQt5.QtWidgets", "PyQt:PyQt5.QtX11Extras", "Python:importlib.resources", "Python:ssl", "PyQt:PyQt5.QtNetwork", "Python:configparser", "Python:json", "Python:platform", "Python:webbrowser", "Python:__future__", "Python:logging", "Python:cgi", "Python:gzip", "scapy:scapy", "Python:ctypes", "Python:ctypes.util"]

[Application]
entry_point = ""
is_console = false
is_bundle = false
name = "AirbnbScanner"
qmake_configuration = ""
script = "src/main.py"
syspath = ""

[Application.Package]
name = "/home/lola/Workspace/AirbnbScanner"
exclude = [ "__pycache__", "*.tar.gz", ".github", ".gitignore", "*.tar.xz", ".pylintrc", ".vs", ".vscode", ".travis.yml", "sysroot-win-64", "build-win-64", "*.pyo", "screenshots", "patches", "pkg-debian", "scripts", "build-linux-64", "sysroot-linux-64", "venv",]
[[Application.Package.Content]]
name = "airbnb-scanner.pdt"
included = false
is_directory = false

[[Application.Package.Content]]
name = "airbnb-scanner.spec"
included = false
is_directory = false

[[Application.Package.Content]]
name = "airbnbscanner.nsi"
included = false
is_directory = false

[[Application.Package.Content]]
name = "build.py"
included = false
is_directory = false

[[Application.Package.Content]]
name = "COPYING"
included = false
is_directory = false

[[Application.Package.Content]]
name = "data"
included = false
is_directory = true
[[Application.Package.Content.Content]]
name = "macaddress.io-db.json"
included = false
is_directory = false

[[Application.Package.Content.Content]]
name = "reported.txt"
included = false
is_directory = false


[[Application.Package.Content]]
name = "icons"
included = false
is_directory = true
[[Application.Package.Content.Content]]
name = "reload-light.svg"
included = false
is_directory = false

[[Application.Package.Content.Content]]
name = "reload.svg"
included = false
is_directory = false

[[Application.Package.Content.Content]]
name = "spy-light.svg"
included = false
is_directory = false

[[Application.Package.Content.Content]]
name = "spy.icns"
included = false
is_directory = false

[[Application.Package.Content.Content]]
name = "spy.ico"
included = false
is_directory = false

[[Application.Package.Content.Content]]
name = "spy.png"
included = false
is_directory = false

[[Application.Package.Content.Content]]
name = "spy.svg"
included = false
is_directory = false

[[Application.Package.Content.Content]]
name = "warning-light.svg"
included = false
is_directory = false

[[Application.Package.Content.Content]]
name = "warning.svg"
included = false
is_directory = false


[[Application.Package.Content]]
name = "LICENSE"
included = false
is_directory = false

[[Application.Package.Content]]
name = "makefile"
included = false
is_directory = false

[[Application.Package.Content]]
name = "README.md"
included = false
is_directory = false

[[Application.Package.Content]]
name = "requirements.txt"
included = false
is_directory = false

[[Application.Package.Content]]
name = "scapy.py"
included = false
is_directory = false

[[Application.Package.Content]]
name = "src"
included = true
is_directory = true
[[Application.Package.Content.Content]]
name = "about.py"
included = true
is_directory = false

[[Application.Package.Content.Content]]
name = "application.py"
included = true
is_directory = false

[[Application.Package.Content.Content]]
name = "device_info.py"
included = true
is_directory = false

[[Application.Package.Content.Content]]
name = "info.py"
included = true
is_directory = false

[[Application.Package.Content.Content]]
name = "main.py"
included = true
is_directory = false

[[Application.Package.Content.Content]]
name = "preferences.py"
included = true
is_directory = false

[[Application.Package.Content.Content]]
name = "utils.py"
included = true
is_directory = false


[[Application.Package.Content]]
name = "sysroot.toml"
included = false
is_directory = false

4 changes: 2 additions & 2 deletions airbnb-scanner.spec
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ datas += Tree('icons', prefix='icons', excludes=[])
a = Analysis(['src/main.py'],
binaries=[],
datas=[],
hiddenimports=[],
hiddenimports=['json', 'os', 'sys', 'platform', 'scapy'],
hookspath=[],
runtime_hooks=[],
excludes=[],
Expand Down Expand Up @@ -45,4 +45,4 @@ coll = COLLECT(exe,
datas,
strip=False,
upx=True,
name='AirbnbScanner')
name='AirbnbScanner')
Loading

0 comments on commit 9a15cfa

Please sign in to comment.