add dissectsr name
This commit is contained in:
@@ -13,6 +13,8 @@ B2WS_SHOW_DISSECTOR_BTN_TITLE = "Show Dissector"
|
|||||||
B2WS_SHOW_DISSECTOR_WIN_TITLE = "Created Dissector"
|
B2WS_SHOW_DISSECTOR_WIN_TITLE = "Created Dissector"
|
||||||
B2WS_CHANGE_SETTINGS_BTN_TITLE = "Change Settings"
|
B2WS_CHANGE_SETTINGS_BTN_TITLE = "Change Settings"
|
||||||
B2WS_CREATE_DISSECTOR_BTN_TITLE = "Create Dissector"
|
B2WS_CREATE_DISSECTOR_BTN_TITLE = "Create Dissector"
|
||||||
|
B2WS_CREATE_DISSECTOR_DLG_TITLE = "Create Dissector"
|
||||||
|
B2WS_CREATE_DISSECTOR_DLG_NAME_LABEL = "dissector name"
|
||||||
B2WS_CHANGE_SETTINGS_DLG_TITLE = "Change Settings"
|
B2WS_CHANGE_SETTINGS_DLG_TITLE = "Change Settings"
|
||||||
B2WS_IMPORT_BLOB_WIN_TITLE = "Import Blob"
|
B2WS_IMPORT_BLOB_WIN_TITLE = "Import Blob"
|
||||||
B2WS_RELOAD_PLUGIN_WIN_TITLE = "Please reload plugin"
|
B2WS_RELOAD_PLUGIN_WIN_TITLE = "Please reload plugin"
|
||||||
|
|||||||
@@ -53,11 +53,12 @@ function b2ws_change_settings(config_string, blob_src, eth_src, eth_dst, eth_typ
|
|||||||
return new_config_string
|
return new_config_string
|
||||||
end
|
end
|
||||||
|
|
||||||
function b2ws_create_dissector(config_string)
|
function b2ws_create_dissector(config_string, disector_name)
|
||||||
local b2ws_config = create_b2ws_config_object(config_string)
|
local b2ws_config = create_b2ws_config_object(config_string)
|
||||||
local template_string = read_b2ws_folder_file(b2ws_const.B2WS_PLUGIN_PATH, b2ws_const.B2WS_DISSECTOR_TEMPLATE_FILE)
|
local template_string = read_b2ws_folder_file(b2ws_const.B2WS_PLUGIN_PATH, b2ws_const.B2WS_DISSECTOR_TEMPLATE_FILE)
|
||||||
template_string = template_string:gsub("0xffff", "0x" .. b2ws_config.eth_fake_header_type)
|
template_string = template_string:gsub("0xffff", "0x" .. b2ws_config.eth_fake_header_type)
|
||||||
local dissector_path = b2ws_config.blob_src .. b2ws_const.B2WS_DISSECTOR_EXTENSION
|
template_string = template_string:gsub("example", disector_name)
|
||||||
|
local dissector_path = create_b2ws_folder_file_path(b2ws_const.B2WS_PLUGIN_PATH, disector_name .. b2ws_const.B2WS_DISSECTOR_EXTENSION)
|
||||||
write_b2ws_file(dissector_path, template_string)
|
write_b2ws_file(dissector_path, template_string)
|
||||||
return dissector_path
|
return dissector_path
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -40,9 +40,13 @@ local function b2ws_win_import_blob()
|
|||||||
b2ws_const.B2WS_CONFIG_LABEL_ETH_FAKE_HEADER_TYPE)
|
b2ws_const.B2WS_CONFIG_LABEL_ETH_FAKE_HEADER_TYPE)
|
||||||
end
|
end
|
||||||
|
|
||||||
local function b2ws_win_btn_create_dissector()
|
local function b2ws_dlg_btn_create_dissector(dissector_name)
|
||||||
|
if dissector_name == "" then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
local win_text = b2ws_trim(win:get_text())
|
local win_text = b2ws_trim(win:get_text())
|
||||||
local dissector_path = b2ws_create_dissector(win_text)
|
local dissector_path = b2ws_create_dissector(win_text, dissector_name)
|
||||||
local info = TextWindow.new(b2ws_const.B2WS_RELOAD_PLUGIN_WIN_TITLE)
|
local info = TextWindow.new(b2ws_const.B2WS_RELOAD_PLUGIN_WIN_TITLE)
|
||||||
info:set(b2ws_const.B2WS_RELOAD_PLUGIN_WIN_CONTENT:gsub("{0}", dissector_path))
|
info:set(b2ws_const.B2WS_RELOAD_PLUGIN_WIN_CONTENT:gsub("{0}", dissector_path))
|
||||||
local function b2ws_win_btn_show_disector()
|
local function b2ws_win_btn_show_disector()
|
||||||
@@ -59,6 +63,12 @@ local function b2ws_win_import_blob()
|
|||||||
info:add_button(b2ws_const.B2WS_SHOW_DISSECTOR_BTN_TITLE, b2ws_win_btn_show_disector)
|
info:add_button(b2ws_const.B2WS_SHOW_DISSECTOR_BTN_TITLE, b2ws_win_btn_show_disector)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
local function b2ws_win_btn_create_dissector()
|
||||||
|
new_dialog(b2ws_const.B2WS_CREATE_DISSECTOR_DLG_TITLE,
|
||||||
|
b2ws_dlg_btn_create_dissector,
|
||||||
|
b2ws_const.B2WS_CREATE_DISSECTOR_DLG_NAME_LABEL)
|
||||||
|
end
|
||||||
|
|
||||||
win:add_button(b2ws_const.B2WS_IMPORT_BLOB_BTN_TITLE, b2ws_win_btn_import_blob)
|
win:add_button(b2ws_const.B2WS_IMPORT_BLOB_BTN_TITLE, b2ws_win_btn_import_blob)
|
||||||
win:add_button(b2ws_const.B2WS_SAVE_SETTINGS_BTN_TITLE, b2ws_win_btn_save_settings)
|
win:add_button(b2ws_const.B2WS_SAVE_SETTINGS_BTN_TITLE, b2ws_win_btn_save_settings)
|
||||||
win:add_button(b2ws_const.B2WS_CHANGE_SETTINGS_BTN_TITLE, b2ws_win_btn_change_settings)
|
win:add_button(b2ws_const.B2WS_CHANGE_SETTINGS_BTN_TITLE, b2ws_win_btn_change_settings)
|
||||||
|
|||||||
Reference in New Issue
Block a user