| 291 | } |
| 292 | |
| 293 | void FuzzingWindow::toggleFuzzing() |
| 294 | { |
| 295 | if (currentlyFuzzing) //stop it then |
| 296 | { |
| 297 | ui->btnStartStop->setText("Start Fuzzing"); |
| 298 | currentlyFuzzing = false; |
| 299 | fuzzTimer->stop(); |
| 300 | } |
| 301 | else //start it then |
| 302 | { |
| 303 | ui->btnStartStop->setText("Stop Fuzzing"); |
| 304 | currentlyFuzzing = true; |
| 305 | |
| 306 | startID = Utility::ParseStringToNum(ui->txtStartID->text()); |
| 307 | endID = Utility::ParseStringToNum(ui->txtEndID->text()); |
| 308 | |
| 309 | seqIDScan = ui->rbSequentialID->isChecked(); |
| 310 | rangeIDSelect = ui->rbRangeIDSel->isChecked(); |
| 311 | if (ui->rbSequentialBits->isChecked()) bitSequenceType = BitSequenceType::Sequential; |
| 312 | if (ui->rbRandomBits->isChecked()) |
| 313 | { |
| 314 | bitSequenceType = BitSequenceType::Random; |
| 315 | bitAccum = 0; |
| 316 | } |
| 317 | if (ui->rbSweep->isChecked()) |
| 318 | { |
| 319 | bitSequenceType = BitSequenceType::Sweeping; |
| 320 | for (int i = 0; i < 64; i++) |
| 321 | { |
| 322 | if (bitGrid[i] == 1) |
| 323 | { |
| 324 | bitAccum = i; |
| 325 | break; |
| 326 | } |
| 327 | } |
| 328 | } |
| 329 | |
| 330 | numSentFrames = 0; |
| 331 | |
| 332 | if (seqIDScan) |
| 333 | { |
| 334 | if (rangeIDSelect) |
| 335 | { |
| 336 | currentID = startID; |
| 337 | } |
| 338 | else //IDs by filter. So, select the first filter |
| 339 | { |
| 340 | currentIdx = 0; |
| 341 | currentID = selectedIDs[currentIdx]; |
| 342 | } |
| 343 | } |
| 344 | else //random IDs |
| 345 | { |
| 346 | if (rangeIDSelect) |
| 347 | { |
| 348 | int range = endID - startID; |
| 349 | if (range != 0) currentID = startID + qrand() % range; |
| 350 | else currentID = startID; |