If your planning on storing the IP addresses in a table, you can use the database to do the work for you.
If you set up your table with oct1, oct2, oct3, oct4 as four separate fields, the query is fairly straight forward.
SELECT DISTINCT oct1, oct2, oct3, oct4
INTO #tempCheckIP
FROM ipLog
WHERE timestamp BETWEEN '2006/01/01' AND '2006/02/01'
SELECT oct1, oct2, oct3, count(oct4) AS [Count]
FROM #tempCheckIP
GROUP BY oct1, oct2, oct3
ORDER BY [Count] DESC
DROP TABLE #tempCheckIP
(NOTE: I tried it on MSDE, not MySQL, but I think the syntax is compatible)
That being said, I don't think that is going to be an effective way of detecting a bot. Your probably are going to block legitimate users who happen to be accessing the server from behind the same proxy at the same time.