I'm at a dead end

Discuss how to write good code, break bad code, your current pet projects, or the best way to approach novel problems

I'm at a dead end

Post by cmwarre on Fri Dec 23, 2011 6:44 pm
([msg=63381]see I'm at a dead end[/msg])

Hello all,
I'm working on a project right now and I've hit a dead end with debugging.

Here's the source:
https://github.com/cmwarre/VulnServer

Basically, it's a server that's meant to have vulnerable modules kind of like a wargames server. It's to teach people how to
write/discover exploits in software. My problems are,
1) I don't know how to handle the forks properly and after a client connects and the main program forks I lose control of the program (this is in main.c)

2) my writeServer function works some of the time but not all the time. If you want an example go ahead and compile the code and enter the command "HELP". It should list all of the installed modules by name but it won't say anything. If you enter "LEV1" it will display the usage for the first wargame module. So it works part of the time, but not all the time.
(This bug is mainly in the files VulnSocket.c and VulnFunction.c)

3) I've got a TODO file with more bugs but these were the only two giving me trouble at the moment...

If any of you can shed light on either of these I would be more than happy. Also, if you feel like contributing at all I would be very happy too!
cmwarre
New User
New User
 
Posts: 7
Joined: Sun Jan 16, 2011 6:08 pm
Blog: View Blog (0)


Re: I'm at a dead end

Post by mShred on Sat Dec 24, 2011 2:32 pm
([msg=63387]see Re: I'm at a dead end[/msg])

I'm not really taking much time to look and be thorough here, but check here for your process forking problem. http://osix.net/modules/article/?id=641
For your second problem. My guess would be that it has to do something with your loop. It's probably not that it works some of the time, but rather that it works only the first time. I'd go back and make sure everything is working correctly. If it is a loop problem, you can always throw in some printf's to see where/if it's getting stuck anywhere.
I didn't even take the time to look through any of the code so this is all just a guess. Post back later with more information.
Image

For those about to rock.
User avatar
mShred
Administrator
Administrator
 
Posts: 1613
Joined: Tue Jun 22, 2010 4:22 pm
Blog: View Blog (2)


Re: I'm at a dead end

Post by cmwarre on Sun Dec 25, 2011 9:46 pm
([msg=63404]see Re: I'm at a dead end[/msg])

ah. My forking problem was just a really stupid mistake. The problem with writing to the server socket is definitely not a loop though. I'm thinking it could be a race condition? I just have absolutely no idea how to debug/solve it. I've noticed my server log doesn't work either but the connected client log works perfectly...
cmwarre
New User
New User
 
Posts: 7
Joined: Sun Jan 16, 2011 6:08 pm
Blog: View Blog (0)


Re: I'm at a dead end

Post by mShred on Tue Dec 27, 2011 3:20 pm
([msg=63431]see Re: I'm at a dead end[/msg])

cmwarre wrote:I've noticed my server log doesn't work either but the connected client log works perfectly...

Would this have something to do with the way the connections are being made, rather than actual bugs in your code? I would check to make sure the connections are working exactly the way you want them to.
Image

For those about to rock.
User avatar
mShred
Administrator
Administrator
 
Posts: 1613
Joined: Tue Jun 22, 2010 4:22 pm
Blog: View Blog (2)


Re: I'm at a dead end

Post by cmwarre on Fri Dec 30, 2011 9:56 pm
([msg=63477]see Re: I'm at a dead end[/msg])

well I was using telnet on the client side. Do you think this could be the problem? I could write up a real quick tcp client in perl if I need to
cmwarre
New User
New User
 
Posts: 7
Joined: Sun Jan 16, 2011 6:08 pm
Blog: View Blog (0)


Re: I'm at a dead end

Post by mShred on Mon Jan 02, 2012 11:24 pm
([msg=63489]see Re: I'm at a dead end[/msg])

cmwarre wrote:well I was using telnet on the client side. Do you think this could be the problem? I could write up a real quick tcp client in perl if I need to

I'm not sure. Unless something is going wrong with the connection, it should be fine. But yeah, I'd go with trying to tcp client first. And see how that works.
Image

For those about to rock.
User avatar
mShred
Administrator
Administrator
 
Posts: 1613
Joined: Tue Jun 22, 2010 4:22 pm
Blog: View Blog (2)



Return to Programming

Who is online

Users browsing this forum: No registered users and 0 guests