8.3 KiB
Debian Packaging Guide for NexTOR IP Changer
This guide provides complete instructions for building, testing, and deploying the NexTOR IP Changer as a Debian package.
Table of Contents
- Overview
- Prerequisites
- Package Structure
- Building the Package
- Testing the Package
- Installation
- Troubleshooting
Overview
Package Name: nextor
Version: 1.1
License: MIT
Architecture: all (architecture-independent)
Section: utils
NexTOR IP Changer is a command-line tool for rotating Tor exit nodes and changing your public IP address dynamically.
Prerequisites
Required Tools
sudo apt-get update
sudo apt-get install -y \
build-essential \
debhelper \
dh-python \
python3-setuptools \
python3-all \
devscripts \
lintian \
fakeroot \
git
System Requirements
- Debian-based system (Ubuntu, Kali Linux, etc.)
- Python 3.6 or later
- Git (for version control)
Package Structure
The complete Debian package structure is as follows:
NexTOR_IP_CHANGER/
├── debian/ # Debian packaging files
│ ├── control # Package metadata
│ ├── changelog # Release history
│ ├── copyright # License information
│ ├── rules # Build rules
│ ├── install # File installation instructions
│ ├── nextor.1 # Man page
│ ├── compat # Debhelper compatibility level
│ └── source/
│ └── format # Source format specification
├── Nex_Tor_IP_changer/ # Python package directory
│ ├── __init__.py # Package initialization
│ ├── NexTOR.py # Main executable
│ ├── nex.py # Utility functions
│ └── install.py # Installation utilities
├── setup.py # Python package setup
├── pyproject.toml # Build system configuration
├── MANIFEST.in # Build manifest
├── .gitignore # Git ignore rules
├── LICENSE # MIT License
└── README.md # Project documentation
Debian Files Explained
debian/control
- Source: Package source metadata
- Package: Binary package configuration
- Dependencies (Depends, Recommends, Conflicts)
- Homepage, version control links
debian/changelog
- Maintains release history
- Required Debian policy file
- Format:
package (version) distribution; urgency=level
debian/copyright
- Specifies licensing information
- Lists copyright holders
- Required by Debian policy
debian/rules
- Makefile for building the package
- Uses debhelper (dh)
- Automates compilation and installation
debian/install
- Specifies which files to install
- Format:
source destination - Example:
NexTOR.py usr/share/nextor/
debian/nextor.1
- Man page (documentation)
- Accessed via
man nextor - Standard Debian documentation file
debian/source/format
- Specifies packaging format:
3.0 (quilt)for source format v3
debian/compat
- Debhelper compatibility level
- Current standard: level 13
Building the Package
Step 1: Prepare the Build Environment
cd /path/to/NexTOR_IP_CHANGER
Step 2: Install Build Dependencies
sudo apt-get build-dep .
Or manually:
sudo apt-get install -y \
debhelper-compat \
dh-python \
python3-setuptools \
python3-all
Step 3: Build the Package
Option A: Using debuild (Recommended)
debuild -us -uc
Flags Explanation:
-us: Don't sign source file-uc: Don't sign changes file
Output Files: Generated in parent directory
nextor_1.1-1_all.deb- Binary packagenextor_1.1-1.dsc- Source package descriptionnextor_1.1-1.tar.gz- Source tarballnextor_1.1-1_amd64.changes- Changes file
Option B: Using dpkg-buildpackage
dpkg-buildpackage -us -uc -b
Flags:
-us: Don't sign source file-uc: Don't sign changes file-b: Build binary package only
Option C: Using debuild with Signing (Release)
debuild -S
This creates signed source package for upload to repositories.
Step 4: Check Build Output
ls -lh ../nextor*.deb
file ../nextor_1.1-1_all.deb
Testing the Package
1. Linting with lintian
Check for Debian Policy violations:
lintian -i ../nextor_1.1-1_all.deb
Output Levels:
E:- Error (must fix)W:- Warning (should fix)I:- Info (informational)N:- Note (minor issue)
2. Installation Test
# Install the package
sudo dpkg -i ../nextor_1.1-1_all.deb
# Verify installation
dpkg -l | grep nextor
which nextor
# Check installed files
dpkg -L nextor
3. Functional Testing
# Check dependencies
nextor --help 2>&1 || echo "May require manual setup"
# View man page
man nextor
# Test import
python3 -c "from Nex_Tor_IP_changer import NexTOR; print('Import successful')"
4. Uninstall Test
sudo apt-get remove nextor
sudo apt-get purge nextor
Verify clean removal:
dpkg -L nextor 2>&1 | grep "No such file"
Installation
Method 1: Installation from Built Package
sudo dpkg -i nextor_1.1-1_all.deb
sudo apt-get install -f # Fix any dependency issues
Method 2: Installation from Repository (Future)
When the package is added to Kali Linux repository:
sudo apt-get update
sudo apt-get install nextor
Post-Installation
- Ensure Tor is installed and running:
sudo apt-get install tor
sudo systemctl enable tor
sudo systemctl start tor
- Verify installation:
nextor --help
man nextor
Build Troubleshooting
Common Issues
1. "Package not found" or dependency errors
Solution:
sudo apt-get update
sudo apt-get install -y python3-setuptools dh-python
2. "Permission denied" during build
Solution:
chmod +x debian/rules
sudo chown $USER:$USER -R .
3. lintian reports errors
Common errors and fixes:
| Error | Solution |
|---|---|
E: changelog-is-dh_make-template |
Update changelog with real changes |
W: maintainer-not-in-uploaders |
Add maintainer to Uploaders field |
W: missing-upstream-changelog |
Add upstream changelog |
E: missing-build-depends |
Add missing tool to Build-Depends |
4. Build fails with "missing dependency"
# Auto-install build dependencies
sudo apt-get build-dep .
# Or manually from debian/control
sudo apt-get install $(grep Build-Depends debian/control \
| sed 's/.*: //; s/,.*//; s/\[.*\]//g')
5. Python import errors
Ensure package has __init__.py:
touch Nex_Tor_IP_changer/__init__.py
Debug Commands
# See full build process
debuild -v
# Extract and inspect binary package
dpkg-deb -x ../nextor_1.1-1_all.deb /tmp/nextor-inspect
# List package contents
dpkg -c ../nextor_1.1-1_all.deb
# Show package information
dpkg-deb -I ../nextor_1.1-1_all.deb
# Check dependencies
dpkg -I ../nextor_1.1-1_all.deb | grep Depends
Clean Up
Clean build artifacts:
# Remove build directory
debclean
# Remove all build files
rm -f ../nextor*
rm -rf debian/nextor/
rm -rf build/ dist/ *.egg-info/
# Clean source tree
fakeroot debian/rules clean
Checklist Before Release
- Version bumped in
debian/changelog lintianreports no errors- Package installs without errors
nextorcommand works- Man page is readable:
man nextor - All dependencies correct in
debian/control - Copyright file complete and accurate
- LICENSE file present
- README documentation up-to-date