Deny Access by IP

Hello,

I was curious, is there any way to block income IP? for example when you have static IP and you are getting DDoSed, is there any way to get the IP(s) that's DDoSing you and then block somehow access from that IP? I was thinking about doing "server" via sockets with my IP and some opened port, for example 80, and then get the IP that's sending packets to that port and block it from sending, can it be done?
Sounds like you are trying to replicate some firewall behavior. I am no expert in firewalls or networking, but this surely sounds like a job for the firewall. Have you checked firewall software to see if this feature is offered already?
actually yes, firewall can do this, but you have to manually insert those IPs and ports, and when you are getting DDoSed from, for example, 10 000 computers it's pretty hard to block all of them, anyway I'm not creating some sort of firewall, I'm just "improving" my skills, I've already created chat server-client app, but unfortunatelly I don't have source code of that on this computer and I'm not at home, but I think that this could be possible by:

1. accept the connection to my app that will be listening to port, for example my app will be listening to port 80, so someone will DDoS me via port 80 it will "connect" him
2. check IP that's connecting
3. if it is blocked IP (it will use MySQL for example) then it will disconnect "client"

but i'm not sure if it is possible and I unfortunatelly - how I said - don't have my sources here now and I don't know all winsock commands since I was doing only once with winsock, so I can't test it now, I'm just curious if the program like I described above will work and disconnect client BEFORE receiving ANY packet or not, so I won't waste my time fnding commands on msdn :P
Last edited on
Well, if this is for Windows Vista and up, see Windows Filtering Platform: http://msdn.microsoft.com/en-us/library/windows/hardware/gg463267.aspx .

I am a complete ignorant of the topic, but I know this is the technology of choice for what you are after... I think! haha
well that's the bonus thing, I just want to get better in winsock, so I have to do this :/ but thanks anyway ! soooo can someone tell me if it is possible to do it like that? app that will listen to open port, for example 80 and block communication if it is blocked IP?
Last edited on
So do you want the client to connect and then disconnect if blocked, or not be able to connect at all if blocked? You can use winsock's setsockopt() function with SO_CONDITIONAL_ACCEPT which you can read about here: http://msdn.microsoft.com/en-us/library/dd264794%28VS.85%29.aspx
I'm not creating some sort of firewall, I'm just "improving" my skills
You may find that learning about firewalls is improving your skills.

And if you do decide to look into it, I'd recommend looking into OpenBSD's PF.
Topic archived. No new replies allowed.