spoof-d 0.4.0 → 0.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +314 -4
- package/bin/cmd.js +208 -31
- package/completions/spoofy.bash +148 -0
- package/completions/spoofy.fish +73 -0
- package/completions/spoofy.ps1 +160 -0
- package/completions/spoofy.zsh +159 -0
- package/index.js +24 -1
- package/lib/networkmanager.js +241 -0
- package/package.json +69 -61
package/README.md
CHANGED
|
@@ -7,9 +7,9 @@
|
|
|
7
7
|
|
|
8
8
|
> **✅ Cross-Platform Support**: This is a modernized fork of the original `spoof` project, updated for compatibility with modern macOS (Sequoia 15.4+, Tahoe 26+), Windows 10/11, and Linux. All platforms are now fully supported!
|
|
9
9
|
|
|
10
|
-
### Easily spoof your MAC address on macOS, Windows, and Linux!
|
|
10
|
+
### Easily spoof your MAC address and DUID on macOS, Windows, and Linux!
|
|
11
11
|
|
|
12
|
-
A Node.js utility for changing MAC addresses across all major platforms. Features reliable macOS support, modern Windows PowerShell integration, and Linux `ip link` commands. This fork includes enhanced error handling, automatic verification, retry logic, and improved cross-platform compatibility.
|
|
12
|
+
A Node.js utility for changing MAC addresses and DHCPv6 DUIDs across all major platforms. Features reliable macOS support, modern Windows PowerShell integration, and Linux `ip link` commands. This fork includes enhanced error handling, automatic verification, retry logic, and improved cross-platform compatibility.
|
|
13
13
|
|
|
14
14
|
## About This Fork
|
|
15
15
|
|
|
@@ -85,6 +85,110 @@ npm install -g .
|
|
|
85
85
|
|
|
86
86
|
This gives you the latest development version with all the latest features.
|
|
87
87
|
|
|
88
|
+
## Shell Completions
|
|
89
|
+
|
|
90
|
+
`spoof-d` includes shell completion support for bash, zsh, fish, and PowerShell, making it easier to use the CLI with tab completion.
|
|
91
|
+
|
|
92
|
+
### Automatic Installation
|
|
93
|
+
|
|
94
|
+
The easiest way to install completions is using the built-in command:
|
|
95
|
+
|
|
96
|
+
```bash
|
|
97
|
+
spoofy completion
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
This will automatically detect your shell and install the appropriate completion file. You can also specify a shell explicitly:
|
|
101
|
+
|
|
102
|
+
```bash
|
|
103
|
+
spoofy completion --shell=bash
|
|
104
|
+
spoofy completion --shell=zsh
|
|
105
|
+
spoofy completion --shell=fish
|
|
106
|
+
spoofy completion --shell=powershell
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
### Manual Installation
|
|
110
|
+
|
|
111
|
+
#### Bash
|
|
112
|
+
|
|
113
|
+
```bash
|
|
114
|
+
# Copy completion file
|
|
115
|
+
mkdir -p ~/.bash_completion.d
|
|
116
|
+
cp completions/spoofy.bash ~/.bash_completion.d/spoofy
|
|
117
|
+
|
|
118
|
+
# Add to ~/.bashrc
|
|
119
|
+
echo "source ~/.bash_completion.d/spoofy" >> ~/.bashrc
|
|
120
|
+
source ~/.bashrc
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
Or install globally (requires root):
|
|
124
|
+
|
|
125
|
+
```bash
|
|
126
|
+
sudo cp completions/spoofy.bash /etc/bash_completion.d/spoofy
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
#### Zsh
|
|
130
|
+
|
|
131
|
+
```bash
|
|
132
|
+
# Copy completion file
|
|
133
|
+
mkdir -p ~/.zshrc.d
|
|
134
|
+
cp completions/spoofy.zsh ~/.zshrc.d/_spoofy
|
|
135
|
+
|
|
136
|
+
# Add to ~/.zshrc
|
|
137
|
+
echo "fpath=(~/.zshrc.d \$fpath)" >> ~/.zshrc
|
|
138
|
+
echo "autoload -U compinit && compinit" >> ~/.zshrc
|
|
139
|
+
source ~/.zshrc
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
Or install globally (requires root):
|
|
143
|
+
|
|
144
|
+
```bash
|
|
145
|
+
sudo cp completions/spoofy.zsh /usr/local/share/zsh/site-functions/_spoofy
|
|
146
|
+
```
|
|
147
|
+
|
|
148
|
+
#### Fish
|
|
149
|
+
|
|
150
|
+
```bash
|
|
151
|
+
# Copy completion file
|
|
152
|
+
mkdir -p ~/.config/fish/completions
|
|
153
|
+
cp completions/spoofy.fish ~/.config/fish/completions/spoofy.fish
|
|
154
|
+
```
|
|
155
|
+
|
|
156
|
+
Fish will automatically load completions from `~/.config/fish/completions/`. Just restart your fish shell.
|
|
157
|
+
|
|
158
|
+
Or install globally (requires root):
|
|
159
|
+
|
|
160
|
+
```bash
|
|
161
|
+
sudo cp completions/spoofy.fish /usr/share/fish/completions/spoofy.fish
|
|
162
|
+
```
|
|
163
|
+
|
|
164
|
+
#### PowerShell
|
|
165
|
+
|
|
166
|
+
```powershell
|
|
167
|
+
# Copy completion file
|
|
168
|
+
New-Item -ItemType Directory -Force -Path (Split-Path $PROFILE)
|
|
169
|
+
Copy-Item completions/spoofy.ps1 $PROFILE
|
|
170
|
+
|
|
171
|
+
# Add to PowerShell profile
|
|
172
|
+
Add-Content $PROFILE ". $PROFILE"
|
|
173
|
+
|
|
174
|
+
# Reload profile
|
|
175
|
+
. $PROFILE
|
|
176
|
+
```
|
|
177
|
+
|
|
178
|
+
Or add manually to your profile:
|
|
179
|
+
|
|
180
|
+
```powershell
|
|
181
|
+
. C:\path\to\completions\spoofy.ps1
|
|
182
|
+
```
|
|
183
|
+
|
|
184
|
+
### Features
|
|
185
|
+
|
|
186
|
+
- **Command completion**: Tab-complete all available commands (`list`, `set`, `randomize`, `duid`, etc.)
|
|
187
|
+
- **Interface name completion**: Automatically suggests available network interfaces
|
|
188
|
+
- **Option completion**: Tab-complete all flags and options (`--wifi`, `--verbose`, etc.)
|
|
189
|
+
- **DUID subcommand completion**: Full completion support for DUID commands
|
|
190
|
+
- **Context-aware**: Completions adapt based on the current command and position
|
|
191
|
+
|
|
88
192
|
## Quick Start
|
|
89
193
|
|
|
90
194
|
### List network interfaces
|
|
@@ -173,7 +277,11 @@ sudo spoofy reset wi-fi
|
|
|
173
277
|
|
|
174
278
|
## DUID Spoofing (DHCPv6)
|
|
175
279
|
|
|
280
|
+
<<<<<<< HEAD
|
|
176
281
|
`spoof-d` also supports DHCPv6 DUID (DHCP Unique Identifier) spoofing for complete IPv6 network identity management.
|
|
282
|
+
=======
|
|
283
|
+
spoofy also supports DHCPv6 DUID (DHCP Unique Identifier) spoofing for complete IPv6 network identity management.
|
|
284
|
+
>>>>>>> upstream/master
|
|
177
285
|
|
|
178
286
|
### What is a DUID?
|
|
179
287
|
|
|
@@ -183,8 +291,13 @@ A DUID (DHCP Unique Identifier) is used in DHCPv6 to uniquely identify a client
|
|
|
183
291
|
|
|
184
292
|
The first time you spoof your DUID, your **original DUID is automatically saved** to:
|
|
185
293
|
- macOS: `/var/db/dhcpclient/DUID.original`
|
|
294
|
+
<<<<<<< HEAD
|
|
186
295
|
- Linux: `/var/lib/spoofy/duid.original`
|
|
187
296
|
- Windows: `%PROGRAMDATA%\spoofy\duid.original`
|
|
297
|
+
=======
|
|
298
|
+
- Linux: `/var/lib/spoofy/duid.original` *(planned)*
|
|
299
|
+
- Windows: `%PROGRAMDATA%\spoofy\duid.original` *(planned)*
|
|
300
|
+
>>>>>>> upstream/master
|
|
188
301
|
|
|
189
302
|
This allows you to **restore to your pre-spoofing state** at any time using `spoofy duid restore`.
|
|
190
303
|
|
|
@@ -264,6 +377,7 @@ sudo spoofy duid reset en0
|
|
|
264
377
|
| 3 | DUID-LL | Link-layer address only (default) |
|
|
265
378
|
| 4 | DUID-UUID | UUID-based identifier |
|
|
266
379
|
|
|
380
|
+
<<<<<<< HEAD
|
|
267
381
|
### Show detailed interface information
|
|
268
382
|
|
|
269
383
|
```bash
|
|
@@ -414,6 +528,79 @@ Long-running operations show progress indicators:
|
|
|
414
528
|
|
|
415
529
|
```bash
|
|
416
530
|
⏳ Changing MAC address... ✓ Successfully set MAC address
|
|
531
|
+
=======
|
|
532
|
+
### Programmatic Usage
|
|
533
|
+
|
|
534
|
+
```javascript
|
|
535
|
+
const spoofy = require('spoofy');
|
|
536
|
+
|
|
537
|
+
// Get current DUID
|
|
538
|
+
const current = spoofy.duid.getCurrentDUID();
|
|
539
|
+
console.log('Current DUID:', spoofy.duid.formatDUID(current));
|
|
540
|
+
|
|
541
|
+
// Parse DUID info
|
|
542
|
+
const info = spoofy.duid.parseDUID(current);
|
|
543
|
+
console.log('Type:', info.typeName);
|
|
544
|
+
console.log('MAC:', info.lladdr);
|
|
545
|
+
|
|
546
|
+
// Check if original is stored
|
|
547
|
+
if (spoofy.duid.hasOriginalDUID()) {
|
|
548
|
+
const original = spoofy.duid.getOriginalDUID();
|
|
549
|
+
console.log('Original DUID:', spoofy.duid.formatDUID(original));
|
|
550
|
+
}
|
|
551
|
+
|
|
552
|
+
// Generate a random DUID
|
|
553
|
+
const newDuid = spoofy.duid.generateDUID(spoofy.duid.DUID_TYPES.DUID_LL);
|
|
554
|
+
console.log('Generated:', spoofy.duid.formatDUID(newDuid));
|
|
555
|
+
|
|
556
|
+
// Set DUID (requires root) - automatically saves original on first call
|
|
557
|
+
spoofy.duid.setDUID(newDuid, 'en0');
|
|
558
|
+
|
|
559
|
+
// Randomize DUID
|
|
560
|
+
spoofy.duid.randomizeDUID(spoofy.duid.DUID_TYPES.DUID_LLT, 'en0');
|
|
561
|
+
|
|
562
|
+
// Sync DUID to current MAC address
|
|
563
|
+
spoofy.duid.syncDUID('en0', spoofy.duid.DUID_TYPES.DUID_LL);
|
|
564
|
+
|
|
565
|
+
// Restore to original DUID
|
|
566
|
+
spoofy.duid.restoreDUID('en0');
|
|
567
|
+
```
|
|
568
|
+
|
|
569
|
+
### Combined MAC + DUID Spoofing
|
|
570
|
+
|
|
571
|
+
For complete identity change on IPv6 networks, you should change both MAC and DUID.
|
|
572
|
+
|
|
573
|
+
**Recommended workflow using sync:**
|
|
574
|
+
|
|
575
|
+
```bash
|
|
576
|
+
sudo spoofy randomize en0 # Spoof MAC first
|
|
577
|
+
sudo spoofy duid sync en0 # Sync DUID to match spoofed MAC
|
|
578
|
+
```
|
|
579
|
+
|
|
580
|
+
The `sync` command automatically matches the DUID to your current (spoofed) MAC address.
|
|
581
|
+
|
|
582
|
+
**Alternative - randomize both separately:**
|
|
583
|
+
|
|
584
|
+
```bash
|
|
585
|
+
sudo spoofy randomize en0
|
|
586
|
+
sudo spoofy duid randomize en0
|
|
587
|
+
```
|
|
588
|
+
|
|
589
|
+
**Manual sync for advanced use:**
|
|
590
|
+
|
|
591
|
+
When using DUID-LL or DUID-LLT types, the DUID includes the MAC address. For consistent spoofing, ensure the MAC in your DUID matches your spoofed MAC:
|
|
592
|
+
|
|
593
|
+
```javascript
|
|
594
|
+
const spoofy = require('spoofy');
|
|
595
|
+
|
|
596
|
+
// Spoof MAC
|
|
597
|
+
const newMac = '00:11:22:33:44:55';
|
|
598
|
+
spoofy.setInterfaceMAC('en0', newMac, 'Wi-Fi');
|
|
599
|
+
|
|
600
|
+
// Create matching DUID
|
|
601
|
+
const duid = spoofy.duid.generateDUID(spoofy.duid.DUID_TYPES.DUID_LL, newMac);
|
|
602
|
+
spoofy.duid.setDUID(duid, 'en0');
|
|
603
|
+
>>>>>>> upstream/master
|
|
417
604
|
```
|
|
418
605
|
|
|
419
606
|
## Platform Support
|
|
@@ -460,7 +647,125 @@ sudo spoofy set 00:11:22:33:44:55 wlan0
|
|
|
460
647
|
|
|
461
648
|
- WiFi will briefly disconnect when changing MAC address
|
|
462
649
|
- Some network restrictions or hardware may prevent MAC spoofing
|
|
463
|
-
- Requires sudo/root privileges for all MAC address changes
|
|
650
|
+
- Requires sudo/root privileges for all MAC address and DUID changes
|
|
651
|
+
- DUID changes may require DHCPv6 lease renewal to take effect
|
|
652
|
+
|
|
653
|
+
## NetworkManager Integration (Linux)
|
|
654
|
+
|
|
655
|
+
On Linux systems using NetworkManager, MAC address changes may be immediately overwritten by NetworkManager if the interface is managed. `spoof-d` includes NetworkManager detection and integration to help prevent this issue.
|
|
656
|
+
|
|
657
|
+
### Automatic Detection
|
|
658
|
+
|
|
659
|
+
When changing MAC addresses on Linux, `spoof-d` automatically:
|
|
660
|
+
- Detects if NetworkManager is present and running
|
|
661
|
+
- Checks if the target interface is managed by NetworkManager
|
|
662
|
+
- Warns you if the interface is managed (MAC changes may be overwritten)
|
|
663
|
+
|
|
664
|
+
### Using `--nm-reconnect`
|
|
665
|
+
|
|
666
|
+
To automatically reconnect the NetworkManager device after a MAC change:
|
|
667
|
+
|
|
668
|
+
```bash
|
|
669
|
+
sudo spoofy randomize eth0 --nm-reconnect
|
|
670
|
+
```
|
|
671
|
+
|
|
672
|
+
This will:
|
|
673
|
+
1. Change the MAC address
|
|
674
|
+
2. Disconnect the device from NetworkManager
|
|
675
|
+
3. Reconnect the device to apply the new MAC address
|
|
676
|
+
|
|
677
|
+
### Force NetworkManager Restart
|
|
678
|
+
|
|
679
|
+
If normal reconnection doesn't work, you can force NetworkManager to restart networking (use with caution):
|
|
680
|
+
|
|
681
|
+
```bash
|
|
682
|
+
sudo spoofy randomize eth0 --nm-reconnect --force
|
|
683
|
+
```
|
|
684
|
+
|
|
685
|
+
**Warning:** The `--force` flag will temporarily disable all NetworkManager networking, which may disconnect all network interfaces briefly.
|
|
686
|
+
|
|
687
|
+
### Manual NetworkManager Management
|
|
688
|
+
|
|
689
|
+
If you prefer to manage NetworkManager manually:
|
|
690
|
+
|
|
691
|
+
1. **Temporarily disconnect the device:**
|
|
692
|
+
```bash
|
|
693
|
+
nmcli dev disconnect eth0
|
|
694
|
+
sudo spoofy randomize eth0
|
|
695
|
+
nmcli dev connect eth0
|
|
696
|
+
```
|
|
697
|
+
|
|
698
|
+
2. **Mark device as unmanaged** (persistent):
|
|
699
|
+
Edit `/etc/NetworkManager/NetworkManager.conf`:
|
|
700
|
+
```ini
|
|
701
|
+
[keyfile]
|
|
702
|
+
unmanaged-devices=interface-name:eth0
|
|
703
|
+
```
|
|
704
|
+
Then restart NetworkManager:
|
|
705
|
+
```bash
|
|
706
|
+
sudo systemctl restart NetworkManager
|
|
707
|
+
```
|
|
708
|
+
|
|
709
|
+
3. **Disable NetworkManager for specific interface** (temporary):
|
|
710
|
+
```bash
|
|
711
|
+
nmcli device set eth0 managed no
|
|
712
|
+
sudo spoofy randomize eth0
|
|
713
|
+
nmcli device set eth0 managed yes
|
|
714
|
+
```
|
|
715
|
+
|
|
716
|
+
### Verbose Output
|
|
717
|
+
|
|
718
|
+
Use `--verbose` to see detailed NetworkManager status:
|
|
719
|
+
|
|
720
|
+
```bash
|
|
721
|
+
sudo spoofy randomize eth0 --verbose
|
|
722
|
+
```
|
|
723
|
+
|
|
724
|
+
This will show:
|
|
725
|
+
- NetworkManager detection method (nmcli, systemctl, etc.)
|
|
726
|
+
- Device management status
|
|
727
|
+
- Raw nmcli output for debugging
|
|
728
|
+
|
|
729
|
+
## Testing
|
|
730
|
+
|
|
731
|
+
The project includes test suites for core functionality:
|
|
732
|
+
|
|
733
|
+
### DUID Tests
|
|
734
|
+
|
|
735
|
+
Test DUID generation, parsing, and conversion:
|
|
736
|
+
|
|
737
|
+
```bash
|
|
738
|
+
# Run all DUID tests
|
|
739
|
+
npm run test:duid
|
|
740
|
+
# or
|
|
741
|
+
node test/test-duid.js
|
|
742
|
+
|
|
743
|
+
# Run specific test
|
|
744
|
+
node test/test-duid.js --test=generation
|
|
745
|
+
node test/test-duid.js --test=parsing
|
|
746
|
+
```
|
|
747
|
+
|
|
748
|
+
### NetworkManager Tests (Linux only)
|
|
749
|
+
|
|
750
|
+
Test NetworkManager detection and device status parsing:
|
|
751
|
+
|
|
752
|
+
```bash
|
|
753
|
+
# Run all NetworkManager tests
|
|
754
|
+
npm run test:nm
|
|
755
|
+
# or
|
|
756
|
+
node test/test-networkmanager.js
|
|
757
|
+
|
|
758
|
+
# Run specific test (parsing tests work on any platform)
|
|
759
|
+
node test/test-networkmanager.js --test=parsing
|
|
760
|
+
```
|
|
761
|
+
|
|
762
|
+
### Run All Tests
|
|
763
|
+
|
|
764
|
+
```bash
|
|
765
|
+
npm run test:all
|
|
766
|
+
```
|
|
767
|
+
|
|
768
|
+
**Note:** NetworkManager tests require a Linux system with NetworkManager installed. Parsing tests work on any platform.
|
|
464
769
|
|
|
465
770
|
## Troubleshooting
|
|
466
771
|
|
|
@@ -469,6 +774,7 @@ sudo spoofy set 00:11:22:33:44:55 wlan0
|
|
|
469
774
|
2. Ensure WiFi is turned on before attempting to change MAC
|
|
470
775
|
3. On modern macOS, you may need to reconnect to WiFi after the change
|
|
471
776
|
4. Try running `networksetup -detectnewhardware` if changes don't take effect
|
|
777
|
+
5. For DUID changes, you may need to disable/re-enable IPv6 or renew DHCPv6 lease
|
|
472
778
|
|
|
473
779
|
### Windows
|
|
474
780
|
1. **Run as Administrator**: Right-click PowerShell or Command Prompt and select "Run as Administrator"
|
|
@@ -480,8 +786,12 @@ sudo spoofy set 00:11:22:33:44:55 wlan0
|
|
|
480
786
|
### Linux
|
|
481
787
|
1. Make sure you're running with `sudo` (required for network changes)
|
|
482
788
|
2. Ensure the `ip` command is available (usually in `iproute2` package)
|
|
483
|
-
3.
|
|
789
|
+
3. **NetworkManager conflicts**: If NetworkManager is managing your interface, MAC changes may be overwritten
|
|
790
|
+
- Use `--nm-reconnect` to automatically reconnect after MAC change
|
|
791
|
+
- Or manually disconnect/reconnect: `nmcli dev disconnect <iface>` then `nmcli dev connect <iface>`
|
|
792
|
+
- Or mark interface as unmanaged in NetworkManager config (see NetworkManager Integration section)
|
|
484
793
|
4. Virtual interfaces and certain hardware may not support MAC address changes
|
|
794
|
+
5. If MAC changes don't persist, check NetworkManager status: `nmcli device status`
|
|
485
795
|
|
|
486
796
|
## Contributing
|
|
487
797
|
|