sliver
sliver copied to clipboard
Feature/tcp stager interface support
TCP Stager Interface Name Support
closes: #1880
Details
Added support for binding TCP stagers to specific network interfaces by name (e.g., "tun0", "eth0", etc...), this enhancement allows users to specify either an IP address or a network interface name when starting a TCP stager.
Changes
Core Implementation
// server/rpc/rpc-stager.go
if net.ParseIP(host) == nil {
ifaceIP, err := getInterfaceIP(host)
if err != nil {
return nil, fmt.Errorf("failed to resolve interface %s: %v", host, err)
}
host = ifaceIP
}
Documentation Updates
// client/command/help/long-help.go
You can also specify a network interface name instead of an IP address:
stage-listener --url tcp://tun0:8080 --profile my-sliver-profile
Testing
Automated
- Unit tests for interface name resolution:
go test -tags=server,osusergo,netgo,go_sqlite ./server/c2
Manual
- Test with IP address:
generate stager -a amd64 -f ps1 -L 192.168.45.231 -l 8443
- Test with interface name:
generate stager -a amd64 -f ps1 -L tun0 -l 8443
Both commands successfully:
- Start the TCP stager listener
- Resolve the interface name to its IP address
- Accept connections on the specified port