-
Notifications
You must be signed in to change notification settings - Fork 214
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Allow read buffer size tuning & add readCallback example
- Loading branch information
Showing
3 changed files
with
26 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
def queueRequests(target, wordlists): | ||
global engine | ||
engine = RequestEngine(endpoint=target.endpoint, | ||
concurrentConnections=2, | ||
readCallback=handleRead, | ||
readSize=256, # TCP socket buffer size - the server may choose to send less | ||
) | ||
engine.start() | ||
|
||
engine.queue(target.req) | ||
|
||
# data is *just* the last socket read contents | ||
# so if you're really unlucky your token might get split over two reads | ||
def handleRead(data): | ||
if 'token' in data: | ||
engine.queue('something-using-the-token') | ||
time.sleep(1) # this will delay the remaining reads on this response | ||
|
||
def handleResponse(req, interesting): | ||
table.add(req) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters