Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pppwn list interface (exclude Bluetooth device, virtual adapter, Wi-Fi) #40

Open
oresterosso75 opened this issue May 20, 2024 · 10 comments

Comments

@oresterosso75
Copy link

pppwn
I noticed that pppwn list returns a list of all the interfaces present in the device.
non-essential ones such as Bluetooth Device, Virtual Adapter, Wi-Fi should be excluded from the search.
who knows, maybe filtering with regex?

@oresterosso75 oresterosso75 changed the title pppwn list interface (exclude Bluetooth Device, Virtual Adapter, Wi-Fi) pppwn list interface (exclude Bluetooth device, virtual adapter, Wi-Fi) May 20, 2024
@xfangfang
Copy link
Owner

I use the api provided by the system to obtain network interfaces under macOS. I believe similar functions are also available on Windows. Feel welcome to submit a PR.

PPPwn_cpp/src/main.cpp

Lines 78 to 111 in 5c0b15a

void listInterfaces() {
std::cout << "[+] interfaces: " << std::endl;
#if defined(__APPLE__)
CFArrayRef interfaces = SCNetworkInterfaceCopyAll();
if (!interfaces) {
std::cerr << "[-] Failed to get interfaces" << std::endl;
exit(1);
}
CFIndex serviceCount = CFArrayGetCount(interfaces);
char buffer[1024];
for (CFIndex i = 0; i < serviceCount; ++i) {
auto interface = (SCNetworkInterfaceRef) CFArrayGetValueAtIndex(interfaces, i);
auto serviceName = SCNetworkInterfaceGetLocalizedDisplayName(interface);
auto bsdName = SCNetworkInterfaceGetBSDName(interface);
if (bsdName) {
CFStringGetCString(bsdName, buffer, sizeof(buffer), kCFStringEncodingUTF8);
printf("\t%s ", buffer);
if (serviceName) {
CFStringGetCString(serviceName, buffer, sizeof(buffer), kCFStringEncodingUTF8);
printf("%s", buffer);
}
printf("\n");
}
}
CFRelease(interfaces);
#else
std::vector<pcpp::PcapLiveDevice *> devList = pcpp::PcapLiveDeviceList::getInstance().getPcapLiveDevicesList();
for (pcpp::PcapLiveDevice *dev: devList) {
if (dev->getLoopback()) continue;
std::cout << "\t" << dev->getName() << " " << dev->getDesc() << std::endl;
}
#endif
exit(0);
}

@annahana
Copy link

Wifi should be not removed for people that use it to jailbreak the console with it.

@Gouster4
Copy link

Gouster4 commented Jun 12, 2024

Im not sure about bluetooth, but i guess that ESP32 or similar microcontroller can act as Bluetooth PAN to Wifi bridge, so maybe even bluetooth connection would be possible. I bet that no one would do it over bluetooth, but its still an option.
Maybe also some virtual adapters can be used for PPPwn, like tunnel interfaces that on other end are bridged to router/firewall port which is connected to PS4. But dont take my word on it, i did never tested such a scenario.

@annahana
Copy link

Im not sure about bluetooth, but i guess that ESP32 or similar microcontroller can act as Bluetooth PAN to Wifi bridge, so maybe even bluetooth connection would be possible. I bet that no one would do it over bluetooth, but its still an option. Maybe also some virtual adapters can be used for PPPwn, like tunnel interfaces that on other end are bridged to router/firewall port which is connected to PS4. But dont take my word on it, i did never tested such a scenario.

Yes possible to do it like that. esp32 is not likely to work(much to slow for Bluetooth and wifi)..

@Gouster4
Copy link

Gouster4 commented Jun 12, 2024

So, its reasonable to leave all those options available, because all of them can be used, just not very attractive as LAN or Wifi. Mmost likely no one would use them, but its still an possible option.

@annahana
Copy link

Real hardwar should be listet but the virtual ones and bridges should not be listet. Nobody will ever send the jailbreak to a VM or the bridge between lan and WLAN.adapter.

@Gouster4
Copy link

Gouster4 commented Jun 12, 2024

Real hardwar should be listet but the virtual ones and bridges should not be listet. Nobody will ever send the jailbreak to a VM or the bridge between lan and WLAN.adapter.

When you bridge two interfaces, isn't then bridge itself that interface which you use to communicate with those interfaces? At least I do that so on my firewall. I'm not an expert, so maybe I'm doing it wrong.

@oresterosso75
Copy link
Author

oresterosso75 commented Jun 12, 2024

in my form I use this function:

Class SchedaDiReteItem:
`public class SchedaDiReteItem
{
public NetworkInterface Scheda { get; set; }
public string Descrizione { get; set; }

public override string ToString()
{
    return Descrizione;
}

}`

  • Property Scheda: Stores the instance of NetworkInterface` representing the network interface.
  • Property `Descrizione: Contains a description of the network interface.
  • Method ToString: Overrides the ToString` method to return the description of the network interface when an object of this type is converted to a string.

`private void ethernetScan()
{
NetworkInterface[] networkInterfaces = NetworkInterface.GetAllNetworkInterfaces();

string pattern = @"(\bwi-fi\b|\bwifi\b|\bwireless\b|\bbluetooth\b)";

foreach (NetworkInterface networkInterface in networkInterfaces)
{
    string interfaceName = networkInterface.Description.ToLower();

    // Exclude virtual network interfaces such as loopback
    if (!Regex.IsMatch(interfaceName, pattern) && !networkInterface.Description.ToLower().Contains("loopback"))
    {
        comboBox2.Items.Add(new NetworkInterfaceItem { NetworkInterface = networkInterface, Description = networkInterface.Description });
    }
}

}

`

Retrieval of Network Interfaces

NetworkInterface.GetAllNetworkInterfaces() retrieves all the network interfaces available on the system.

Exclusion Pattern

The pattern @"(\bwi-fi\b|\bwifi\b|\bwireless\b|\bbluetooth\b)" is used to exclude network interfaces based on Wi-Fi, wireless, and Bluetooth.

foreach Loop

Iterates over each network interface.

Interface Name

scheda.Description.ToLower() converts the interface description to lowercase to facilitate comparison.

Exclusion Condition

Network interfaces that contain the terms from the pattern or "loopback" in their description are excluded.

Adding to ComboBox

Network interfaces that are not excluded are added to comboBox2 as SchedaDiReteItem objects.

@annahana
Copy link

Real hardwar should be listet but the virtual ones and bridges should not be listet. Nobody will ever send the jailbreak to a VM or the bridge between lan and WLAN.adapter.

When you bridge two interfaces, isn't then bridge itself that interface which you use to communicate with those interfaces? At least I do that so on my firewall. I'm not an expert, so maybe I'm doing it wrong.

No technically it is a network on its one. If you use it as a interface you send the jealbreak to both sides wlan and lan. In best case you just DDoS your Home Network.

@Gouster4
Copy link

No technically it is a network on its one

Hm... so its better to send it directly to specific interface. Got it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants