Class: Watobo::Gui::FuzzerTree
- Inherits:
-
FXTreeList
- Object
- FXTreeList
- Watobo::Gui::FuzzerTree
show all
- Includes:
- Icons
- Defined in:
- lib/watobo/gui/fuzzer_gui.rb
Constant Summary
Constants included
from Icons
Icons::ICON_ADD_PROJECT, Icons::ICON_BROWSER_MEDIUM, Icons::ICON_BROWSER_SMALL, Icons::ICON_BTN_DOWN, Icons::ICON_BTN_UP, Icons::ICON_CB_CHECKED, Icons::ICON_CB_CHECKED_ORANGE, Icons::ICON_CB_UNCHECKED, Icons::ICON_CONVERSATION, Icons::ICON_DASHBOARD, Icons::ICON_DIFFER, Icons::ICON_FOLDER, Icons::ICON_FOLDER_SMALL, Icons::ICON_FUZZER, Icons::ICON_FUZZER_MEDIUM, Icons::ICON_FUZZER_SMALL, Icons::ICON_FUZZ_FILTER, Icons::ICON_FUZZ_GENERATOR, Icons::ICON_FUZZ_TAG, Icons::ICON_HINTS, Icons::ICON_HINTS_INFO, Icons::ICON_HINTS_INFO_SMALL, Icons::ICON_HINTS_SMALL, Icons::ICON_INFO, Icons::ICON_INFO_INFO, Icons::ICON_INFO_INFO_SMALL, Icons::ICON_INFO_SMALL, Icons::ICON_INFO_USER, Icons::ICON_INFO_USER_SMALL, Icons::ICON_INTERCEPTOR, Icons::ICON_LOGIN_WIZZARD, Icons::ICON_MANUAL_REQUEST, Icons::ICON_MANUAL_REQUEST_MEDIUM, Icons::ICON_MANUAL_REQUEST_SMALL, Icons::ICON_PAUSE, Icons::ICON_PLUGIN, Icons::ICON_PROJECT, Icons::ICON_PROJECT_SMALL, Icons::ICON_REPORT, Icons::ICON_REQUEST, Icons::ICON_REQUEST_SMALL, Icons::ICON_SEND_REQUEST, Icons::ICON_SITE, Icons::ICON_SITE_SMALL, Icons::ICON_START, Icons::ICON_STOP, Icons::ICON_TOKEN, Icons::ICON_TRANSCODER, Icons::ICON_VULN, Icons::ICON_VULN_BP, Icons::ICON_VULN_BP_SMALL, Icons::ICON_VULN_CRITICAL, Icons::ICON_VULN_CRITICAL_SMALL, Icons::ICON_VULN_HIGH, Icons::ICON_VULN_HIGH_SMALL, Icons::ICON_VULN_LOW, Icons::ICON_VULN_LOW_SMALL, Icons::ICON_VULN_MEDIUM, Icons::ICON_VULN_MEDIUM_SMALL, Icons::ICON_VULN_SMALL, Icons::ICON_WATOBO, Icons::SIBERAS_ICON, Icons::TBL_ICON_LOCK, Icons::WATOBO_LOGO
Instance Attribute Summary collapse
Instance Method Summary
collapse
Constructor Details
#initialize(owner, project) ⇒ FuzzerTree
Returns a new instance of FuzzerTree.
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
|
# File 'lib/watobo/gui/fuzzer_gui.rb', line 1377
def initialize(owner, project)
super(owner, :opts => LAYOUT_FILL_X|LAYOUT_FILL_Y|LAYOUT_TOP|LAYOUT_RIGHT|TREELIST_SHOWS_LINES|TREELIST_SHOWS_BOXES|TREELIST_ROOT_BOXES|TREELIST_EXTENDEDSELECT)
@fuzzTags = []
@project = project
@filters = []
setup_listeners()
refresh()
self.connect(SEL_COMMAND) do |sender, sel, item|
if self.itemLeaf?(item)
getApp().beginWaitCursor do
begin
if item.data
if item.data.is_a? Finding
@interface.show_vuln(item.data)
end
end
rescue => bang
puts "!!! Error: could not show selected finding"
puts bang
end
end
elsif item.data == :title then
@interface.show_vuln(item.first.data) if item.first.data
end
end
self.connect(SEL_DOUBLECLICKED) do |sender, sel, item|
if self.itemLeaf?(item)
begin
if item.data and item.data.is_a? Symbol then
case item.data
when :tags
addTag()
when :filter
dlg = Watobo::Gui::CreateFilterDlg.new(self, @project)
if dlg.execute != 0 then
f = dlg.filter
notify(:new_filter, f)
@filters.push f
refresh()
end
end
elsif item.data.respond_to? :is_tag?
dlg = Watobo::Gui::CreateGeneratorDlg.new(self)
if dlg.execute != 0 then
fuzzer = item.data
gen = dlg.getGenerator(fuzzer)
fuzzer.addGenerator(gen)
refresh()
end
elsif item.data.respond_to? :is_generator?
gen = item.data
addAction(gen)
else
puts "Unknown Object: #{item.data.class}"
end
rescue => bang
puts "!!! Error: could not show selected finding"
puts bang
end
end
end
self.connect(SEL_RIGHTBUTTONRELEASE) do |sender, sel, event|
unless event.moved?
item = sender.getItemAt(event.win_x, event.win_y)
FXMenuPane.new(self) do ||
data = item ? self.getItemData(item) : nil
if data.is_a? Symbol
case data
when :tags
m = FXMenuCommand.new(, "Add Tag.." )
m.connect(SEL_COMMAND) {
addTag()
}
when :filter
m = FXMenuCommand.new(, "Add Filter.." )
m.connect(SEL_COMMAND) {
dlg = Watobo::Gui::CreateFilterDlg.new(self, @project)
if dlg.execute != 0 then
f = dlg.filter
notify(:new_filter, f)
@filters.push f
refresh()
end
}
end
elsif data.respond_to? :is_tag?
m = FXMenuCommand.new(, "Add Generator.." )
m.connect(SEL_COMMAND) {
dlg = Watobo::Gui::CreateGeneratorDlg.new(self)
if dlg.execute != 0 then
fuzzer = data
gen = dlg.getGenerator(fuzzer)
fuzzer.addGenerator(gen)
refresh()
end
}
m = FXMenuCommand.new(, "Remove Tag" )
m.connect(SEL_COMMAND) {
if @fuzzTags.include?(data)
@fuzzTags.delete(data)
end
notify(:remove_tag, data)
refresh()
}
elsif data.respond_to? :is_generator?
m = FXMenuCommand.new(, "Add Action.." )
m.connect(SEL_COMMAND) {
gen = self.getItemData(item)
addAction(gen)
}
m = FXMenuCommand.new(, "Remove Generator" )
m.connect(SEL_COMMAND) {
tag = self.getItemData(item.parent)
tag.deleteGenerator(data)
refresh()
}
elsif data.respond_to? :is_action?
m = FXMenuCommand.new(, "Remove Action" )
m.connect(SEL_COMMAND) {
gen = self.getItemData(item.parent)
gen.removeAction(data)
refresh()
}
elsif data.respond_to? :is_filter?
m = FXMenuCommand.new(, "Remove Filter" )
m.connect(SEL_COMMAND) {
@filters.delete(data)
notify(:remove_filter, data)
refresh()
}
else
puts "Unknown Object: #{data.class}"
end
.create
.(nil, event.root_x, event.root_y)
app.runModalWhileShown()
end
end
end
end
|
Instance Attribute Details
Returns the value of attribute fuzzTags.
1239
1240
1241
|
# File 'lib/watobo/gui/fuzzer_gui.rb', line 1239
def fuzzTags
@fuzzTags
end
|
Instance Method Details
#addAction(generator) ⇒ Object
1320
1321
1322
1323
1324
1325
1326
1327
1328
|
# File 'lib/watobo/gui/fuzzer_gui.rb', line 1320
def addAction(generator)
dlg = Watobo::Gui::CreateActionDlg.new(self)
if dlg.execute != 0 then
puts "new action"
new_action = dlg.getAction()
generator.addAction(new_action) if new_action
refresh()
end
end
|
#addFilterItem(filter) ⇒ Object
1260
1261
1262
1263
1264
1265
1266
1267
|
# File 'lib/watobo/gui/fuzzer_gui.rb', line 1260
def addFilterItem(filter)
filter_root = self.findItem("Filters", nil, SEARCH_FORWARD|SEARCH_IGNORECASE)
filter_item = self.appendItem(filter_root, "Filter: #{filter.filter_type}")
self.setItemData(filter_item, filter)
self.appendItem(filter_item, filter.info)
end
|
#addGeneratorItem(tag_item, generator) ⇒ Object
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
|
# File 'lib/watobo/gui/fuzzer_gui.rb', line 1330
def addGeneratorItem(tag_item, generator)
begin
item = self.appendItem(tag_item, generator.genType, ICON_FUZZ_GENERATOR, ICON_FUZZ_GENERATOR)
self.setItemData(item, generator)
self.appendItem(item, generator.info)
generator.actions.each do |a|
action_item = self.appendItem(item, a.action_type, ICON_FUZZER, ICON_FUZZER)
self.setItemData(action_item, a)
self.appendItem(action_item, a.info)
end
self.expandTree(item)
rescue => bang
puts "!ERROR: could not add GeneratorItem"
puts bang
end
end
|
#addTag ⇒ Object
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
|
# File 'lib/watobo/gui/fuzzer_gui.rb', line 1270
def addTag()
dlg = Watobo::Gui::CreateFuzzerDlg.new(self)
if dlg.execute != 0 then
tag = dlg.tag
tag_is_valid = true
@fuzzTags.each do |f|
tag_is_valid = false if f.name == tag
end
if tag_is_valid and tag != ""
new_fuzz_tag = FuzzerTag.new(tag)
@fuzzTags.push new_fuzz_tag
notify(:new_tag, new_fuzz_tag)
refresh()
else
puts "!!! Could not create empty/used tag !!!"
end
end
end
|
#addTagItem(tag) ⇒ Object
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
|
# File 'lib/watobo/gui/fuzzer_gui.rb', line 1289
def addTagItem(tag)
tag_root = self.findItem("Tags", nil, SEARCH_FORWARD|SEARCH_IGNORECASE)
item = self.findItem(tag.name, tag_root, SEARCH_FORWARD|SEARCH_IGNORECASE)
return nil if item
tag_item = self.appendItem(tag_root, "Tag: #{tag.name}")
self.setItemData(tag_item, tag)
tag.generators.each do |gen|
addGeneratorItem(tag_item, gen)
end
end
|
#expandSettings(item = nil) ⇒ Object
1357
1358
1359
1360
1361
|
# File 'lib/watobo/gui/fuzzer_gui.rb', line 1357
def expandSettings(item=nil)
self.each do |root_item|
expandSubtree(root_item)
end
end
|
#expandSubtree(item = nil) ⇒ Object
1348
1349
1350
1351
1352
1353
1354
1355
|
# File 'lib/watobo/gui/fuzzer_gui.rb', line 1348
def expandSubtree(item=nil)
if item
self.expandTree(item)
item.each do |child|
expandSubtree(child)
end
end
end
|
#initTree ⇒ Object
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
|
# File 'lib/watobo/gui/fuzzer_gui.rb', line 1309
def initTree()
fuzz_item = self.appendItem(nil, "Tags", ICON_FUZZ_TAG, ICON_FUZZ_TAG)
self.setItemData(fuzz_item, :tags)
item = self.appendItem(nil, "Filters", ICON_FUZZ_FILTER, ICON_FUZZ_FILTER)
self.setItemData(item, :filter)
end
|
#notify(event, *args) ⇒ Object
1251
1252
1253
1254
1255
1256
1257
|
# File 'lib/watobo/gui/fuzzer_gui.rb', line 1251
def notify(event, *args)
if @event_dispatcher_listeners[event]
@event_dispatcher_listeners[event].each do |m|
m.call(*args) if m.respond_to? :call
end
end
end
|
#refresh ⇒ Object
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
|
# File 'lib/watobo/gui/fuzzer_gui.rb', line 1363
def refresh()
self.clearItems()
initTree()
@fuzzTags.each do |f|
addTagItem(f)
end
@filters.each do |f|
addFilterItem(f)
end
expandSettings()
end
|
#setup_listeners ⇒ Object
1242
1243
1244
1245
|
# File 'lib/watobo/gui/fuzzer_gui.rb', line 1242
def setup_listeners
@event_dispatcher_listeners = {}
end
|
#subscribe(event, &callback) ⇒ Object
1247
1248
1249
|
# File 'lib/watobo/gui/fuzzer_gui.rb', line 1247
def subscribe(event, &callback)
(@event_dispatcher_listeners[event] ||= []) << callback
end
|