Dude… Don't use C for this kind of stuff, it makes things way too complicated.
Regex was made for thing kind of thing.
This can literally be done in one line in Bash ( a very long one albeit ) and a couple of lines in Python
You've got a huge memory leak with 'url'
Just for fun I made it in bash
{ echo '<html><head><title>Export IP Cam</title></head><body>' ; cat bruteforce.log | nl | sed -n "s@\s*\([0-9]\+\)\s*\(\S\+\) - \([^:]\+\):\(.*\)@<div style='border:1px solid#ccc;padding:8px;margin-bottom:8px;'><img style='width:320px;' src='\2snapshot.cgi?user=\3\&pwd=\4'/><b>Source (\1):</b> \2, \3:\4</div>@p" ; echo '</body></html>' ; } > shit.html