-1

I am creating a file that uses Socket for exchanging data. When I use Python I have a firewall pop up where I am asked to accept the use of the application, but when my C++ program tries to do the same, the firewall doesn't warn me. My question is what differs in both cases? Is it the language?

I run it on Windows, and the compiled C++ executable doesn't activate the firewall even when it is being run on another computer.

Python:

import socket

s = socket.socket()
s.bind(("0.0.0.0", 6685))
s.connect(("127.0.0.1", 20545))

C++:

int main(int argc, char** argv)
{
    if (!startUpMenu(argv[0])) // I give the function the path of the application 
        return 1;   // if the application isnt the one in start menu it will stop
    const char* ip = "10.0.0.6"; // the ip of the server
    Socket client = Socket();
    if (client.Connect(ip, 667) == SOCKET_ERROR)
        return -1;

    while (!client.TelNet()) {} // loops the TelNet comunication

}
LeoSegol
  • 1
  • 1
  • 1
    Your firewall is detecting a socket connect/accept from your application, and that looks that is what is detecting your firewall basically. – camp0 Nov 10 '20 at 10:46
  • Your Python *script* triggers a flag, but your compiled binary does not? – schroeder Nov 10 '20 at 11:27
  • What's the firewall? What's your OS? – schroeder Nov 10 '20 at 12:04
  • One difference is that in the python case, the executable is always python.exe, regardless of whether its your own script or some malicious one. So it makes sense to always ask for permission in that case (I guess?). What is less clear is why it doesn't ask for permission for the C++ binary. – kutschkem Nov 10 '20 at 13:29
  • i think i know the answer,but in order to confirm could you show me the code. – yeah_well Nov 11 '20 at 11:36
  • I added it to the question – LeoSegol Nov 13 '20 at 15:39
  • "but when my C++ program tries to do the same" -- they are not doing the same thing at all ... The difference is not the language, but the behavior ... You may hav e been able to answer your own question if you had both programs doing the same thing. – schroeder Nov 13 '20 at 21:51
  • Even if both programs are different, which I'm not really sure what is the big difference, what makes the firewall pop up? why does it jump on my python program? – LeoSegol Nov 18 '20 at 07:53

1 Answers1

0

The python program is attempting to open a port 6685 and listen for incoming requests, as seen in the line s.bind(("0.0.0.0", 6685)). Windows firewall does not like arbitrary processes attempting to listen for incoming connections, so it prompts for acceptance by the end user.

The C++ program is not listening for incoming requests on a port, it is simply connecting out to a separate host.

john doe
  • 648
  • 4
  • 15