├── .gitattributes ├── AUTHORS.txt ├── extension ├── images │ ├── idle.gif │ ├── stop.png │ ├── icon16.png │ ├── icon32.png │ ├── icon48.png │ ├── zoomin.png │ ├── icon128.png │ ├── icon512.jpg │ ├── working.gif │ └── zoomout.png ├── graphics │ └── logo.psd ├── css │ ├── images │ │ └── ui-icons_red_256x240.png │ ├── jquery │ │ ├── sunny │ │ │ └── images │ │ │ │ ├── ui-icons_3d3d3d_256x240.png │ │ │ │ ├── ui-icons_bd7b00_256x240.png │ │ │ │ ├── ui-icons_d19405_256x240.png │ │ │ │ ├── ui-icons_eb990f_256x240.png │ │ │ │ ├── ui-icons_ed9f26_256x240.png │ │ │ │ ├── ui-icons_fadc7a_256x240.png │ │ │ │ ├── ui-icons_ffe180_256x240.png │ │ │ │ ├── ui-bg_flat_30_cccccc_40x100.png │ │ │ │ ├── ui-bg_flat_50_5c5c5c_40x100.png │ │ │ │ ├── ui-bg_inset-soft_30_ffffff_1x100.png │ │ │ │ ├── ui-bg_gloss-wave_45_817865_500x100.png │ │ │ │ ├── ui-bg_gloss-wave_60_fece2f_500x100.png │ │ │ │ ├── ui-bg_gloss-wave_70_ffdd57_500x100.png │ │ │ │ ├── ui-bg_gloss-wave_90_fff9e5_500x100.png │ │ │ │ ├── ui-bg_highlight-soft_100_feeebd_1x100.png │ │ │ │ └── ui-bg_diagonals-medium_20_d34d17_40x40.png │ │ ├── cupertino │ │ │ └── images │ │ │ │ ├── ui-icons_2e83ff_256x240.png │ │ │ │ ├── ui-icons_3d80b3_256x240.png │ │ │ │ ├── ui-icons_72a7cf_256x240.png │ │ │ │ ├── ui-icons_e82631_256x240.png │ │ │ │ ├── ui-icons_ffffff_256x240.png │ │ │ │ ├── ui-bg_glass_100_e4f1fb_1x400.png │ │ │ │ ├── ui-bg_glass_50_3baae3_1x400.png │ │ │ │ ├── ui-bg_glass_80_d7ebf9_1x400.png │ │ │ │ ├── ui-bg_diagonals-thick_25_cd0a0a_40x40.png │ │ │ │ ├── ui-bg_diagonals-thick_50_ffef8f_40x40.png │ │ │ │ ├── ui-bg_diagonals-thick_90_eeeeee_40x40.png │ │ │ │ ├── ui-bg_highlight-hard_100_f2f5f7_1x100.png │ │ │ │ ├── ui-bg_highlight-hard_70_000000_1x100.png │ │ │ │ └── ui-bg_highlight-soft_100_deedf7_1x100.png │ │ └── south-street │ │ │ └── images │ │ │ ├── ui-icons_808080_256x240.png │ │ │ ├── ui-icons_847e71_256x240.png │ │ │ ├── ui-icons_8dc262_256x240.png │ │ │ ├── ui-icons_cd0a0a_256x240.png │ │ │ ├── ui-icons_eeeeee_256x240.png │ │ │ ├── ui-icons_ffffff_256x240.png │ │ │ ├── ui-bg_glass_55_fcf0ba_1x400.png │ │ │ ├── ui-bg_inset-soft_15_2b2922_1x100.png │ │ │ ├── ui-bg_gloss-wave_100_ece8da_500x100.png │ │ │ ├── ui-bg_highlight-hard_100_f5f3e5_1x100.png │ │ │ ├── ui-bg_highlight-hard_100_fafaf4_1x100.png │ │ │ ├── ui-bg_highlight-hard_15_459e00_1x100.png │ │ │ ├── ui-bg_highlight-hard_95_cccccc_1x100.png │ │ │ ├── ui-bg_highlight-soft_25_67b021_1x100.png │ │ │ └── ui-bg_highlight-soft_95_ffedad_1x100.png │ ├── sunny.css │ ├── south-street.css │ ├── cupertino.css │ └── ui.css ├── firefox │ ├── locale │ │ ├── cs-CZ │ │ │ └── conetserv.dtd │ │ └── en-US │ │ │ └── conetserv.dtd │ ├── overlay.css │ ├── chrome.manifest.in │ ├── install.rdf.in │ └── overlay.xul ├── .gitignore ├── js │ ├── onload.js │ ├── firefox.js │ ├── jquery │ │ ├── jquery.flot.valuelabels.js │ │ ├── jquery.client.js │ │ └── jquery.flot.navigate.js │ ├── conetserv.js │ ├── externalinfo.js │ ├── map.js │ ├── console.js │ └── localinfo.js ├── chrome │ └── manifest.json.in ├── opera │ └── config.xml.in ├── test.html └── about.html.in ├── plugin ├── apple │ ├── ._CMakeLists.txt │ ├── Localized.r.in │ ├── Info.plist.in │ └── CMakeLists.txt ├── win │ ├── dll_export.def.in │ ├── shell.h │ ├── process.h │ ├── resource.h │ ├── init_modules.h │ ├── cmd_exe.h │ ├── stdbool.h │ ├── CMakeLists.txt │ ├── resource.rc.in │ ├── ipconfig.c │ ├── nslookup.c │ ├── nmap.c │ ├── tracert.c │ ├── ping.c │ └── cmd_exe.c ├── plugin.h ├── config.h.in ├── debug.c ├── module.h ├── unix │ ├── process.h │ ├── shell.h │ ├── init_modules.h │ ├── CMakeLists.txt │ ├── route.c │ ├── ifconfig.c │ ├── nslookup.c │ ├── traceroute.c │ ├── nmap.c │ ├── ping.c │ ├── dig.c │ └── whois.c ├── identifier.h ├── common │ ├── route.c │ ├── ipconfig.c │ ├── nmap.c │ ├── nslookup.c │ ├── traceroute.c │ └── ping.c ├── debug.h ├── npapi.h ├── identifier.c ├── CMakeLists.txt ├── process.c ├── module.c ├── npapi.c ├── api │ └── conetserv.h └── plugin.c ├── doc ├── about.h.in └── CMakeLists.txt ├── .gitignore ├── CMakePlugins ├── FindXULRunnerSDK.cmake ├── MozillaTargetPlatform.cmake └── NPAPI_NPString_members.cmake ├── CMakeLists.txt ├── TODO.txt ├── README.rst └── CHANGELOG.txt /.gitattributes: -------------------------------------------------------------------------------- 1 | extension/js/jquery/* binary 2 | extension/css/jquery/* binary 3 | -------------------------------------------------------------------------------- /AUTHORS.txt: -------------------------------------------------------------------------------- 1 | Vojtech Vitek (V-Teq) 2 | Marek Vantuch 3 | -------------------------------------------------------------------------------- /extension/images/idle.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VojtechVitek/CoNetServ/HEAD/extension/images/idle.gif -------------------------------------------------------------------------------- /extension/images/stop.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VojtechVitek/CoNetServ/HEAD/extension/images/stop.png -------------------------------------------------------------------------------- /extension/graphics/logo.psd: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VojtechVitek/CoNetServ/HEAD/extension/graphics/logo.psd -------------------------------------------------------------------------------- /extension/images/icon16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VojtechVitek/CoNetServ/HEAD/extension/images/icon16.png -------------------------------------------------------------------------------- /extension/images/icon32.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VojtechVitek/CoNetServ/HEAD/extension/images/icon32.png -------------------------------------------------------------------------------- /extension/images/icon48.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VojtechVitek/CoNetServ/HEAD/extension/images/icon48.png -------------------------------------------------------------------------------- /extension/images/zoomin.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VojtechVitek/CoNetServ/HEAD/extension/images/zoomin.png -------------------------------------------------------------------------------- /extension/images/icon128.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VojtechVitek/CoNetServ/HEAD/extension/images/icon128.png -------------------------------------------------------------------------------- /extension/images/icon512.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VojtechVitek/CoNetServ/HEAD/extension/images/icon512.jpg -------------------------------------------------------------------------------- /extension/images/working.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VojtechVitek/CoNetServ/HEAD/extension/images/working.gif -------------------------------------------------------------------------------- /extension/images/zoomout.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VojtechVitek/CoNetServ/HEAD/extension/images/zoomout.png -------------------------------------------------------------------------------- /plugin/apple/._CMakeLists.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VojtechVitek/CoNetServ/HEAD/plugin/apple/._CMakeLists.txt -------------------------------------------------------------------------------- /doc/about.h.in: -------------------------------------------------------------------------------- 1 | /*! \mainpage @PROJECT_NAME@ (@PROJECT_LONG@) 2 | * 3 | * \section about About 4 | * 5 | * \htmlinclude about.html 6 | */ 7 | -------------------------------------------------------------------------------- /extension/css/images/ui-icons_red_256x240.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VojtechVitek/CoNetServ/HEAD/extension/css/images/ui-icons_red_256x240.png -------------------------------------------------------------------------------- /extension/css/jquery/sunny/images/ui-icons_3d3d3d_256x240.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VojtechVitek/CoNetServ/HEAD/extension/css/jquery/sunny/images/ui-icons_3d3d3d_256x240.png -------------------------------------------------------------------------------- /extension/css/jquery/sunny/images/ui-icons_bd7b00_256x240.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VojtechVitek/CoNetServ/HEAD/extension/css/jquery/sunny/images/ui-icons_bd7b00_256x240.png -------------------------------------------------------------------------------- /extension/css/jquery/sunny/images/ui-icons_d19405_256x240.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VojtechVitek/CoNetServ/HEAD/extension/css/jquery/sunny/images/ui-icons_d19405_256x240.png -------------------------------------------------------------------------------- /extension/css/jquery/sunny/images/ui-icons_eb990f_256x240.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VojtechVitek/CoNetServ/HEAD/extension/css/jquery/sunny/images/ui-icons_eb990f_256x240.png -------------------------------------------------------------------------------- /extension/css/jquery/sunny/images/ui-icons_ed9f26_256x240.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VojtechVitek/CoNetServ/HEAD/extension/css/jquery/sunny/images/ui-icons_ed9f26_256x240.png -------------------------------------------------------------------------------- /extension/css/jquery/sunny/images/ui-icons_fadc7a_256x240.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VojtechVitek/CoNetServ/HEAD/extension/css/jquery/sunny/images/ui-icons_fadc7a_256x240.png -------------------------------------------------------------------------------- /extension/css/jquery/sunny/images/ui-icons_ffe180_256x240.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VojtechVitek/CoNetServ/HEAD/extension/css/jquery/sunny/images/ui-icons_ffe180_256x240.png -------------------------------------------------------------------------------- /extension/css/jquery/cupertino/images/ui-icons_2e83ff_256x240.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VojtechVitek/CoNetServ/HEAD/extension/css/jquery/cupertino/images/ui-icons_2e83ff_256x240.png -------------------------------------------------------------------------------- /extension/css/jquery/cupertino/images/ui-icons_3d80b3_256x240.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VojtechVitek/CoNetServ/HEAD/extension/css/jquery/cupertino/images/ui-icons_3d80b3_256x240.png -------------------------------------------------------------------------------- /extension/css/jquery/cupertino/images/ui-icons_72a7cf_256x240.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VojtechVitek/CoNetServ/HEAD/extension/css/jquery/cupertino/images/ui-icons_72a7cf_256x240.png -------------------------------------------------------------------------------- /extension/css/jquery/cupertino/images/ui-icons_e82631_256x240.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VojtechVitek/CoNetServ/HEAD/extension/css/jquery/cupertino/images/ui-icons_e82631_256x240.png -------------------------------------------------------------------------------- /extension/css/jquery/cupertino/images/ui-icons_ffffff_256x240.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VojtechVitek/CoNetServ/HEAD/extension/css/jquery/cupertino/images/ui-icons_ffffff_256x240.png -------------------------------------------------------------------------------- /extension/css/jquery/sunny/images/ui-bg_flat_30_cccccc_40x100.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VojtechVitek/CoNetServ/HEAD/extension/css/jquery/sunny/images/ui-bg_flat_30_cccccc_40x100.png -------------------------------------------------------------------------------- /extension/css/jquery/sunny/images/ui-bg_flat_50_5c5c5c_40x100.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VojtechVitek/CoNetServ/HEAD/extension/css/jquery/sunny/images/ui-bg_flat_50_5c5c5c_40x100.png -------------------------------------------------------------------------------- /extension/css/jquery/cupertino/images/ui-bg_glass_100_e4f1fb_1x400.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VojtechVitek/CoNetServ/HEAD/extension/css/jquery/cupertino/images/ui-bg_glass_100_e4f1fb_1x400.png -------------------------------------------------------------------------------- /extension/css/jquery/cupertino/images/ui-bg_glass_50_3baae3_1x400.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VojtechVitek/CoNetServ/HEAD/extension/css/jquery/cupertino/images/ui-bg_glass_50_3baae3_1x400.png -------------------------------------------------------------------------------- /extension/css/jquery/cupertino/images/ui-bg_glass_80_d7ebf9_1x400.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VojtechVitek/CoNetServ/HEAD/extension/css/jquery/cupertino/images/ui-bg_glass_80_d7ebf9_1x400.png -------------------------------------------------------------------------------- /extension/css/jquery/south-street/images/ui-icons_808080_256x240.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VojtechVitek/CoNetServ/HEAD/extension/css/jquery/south-street/images/ui-icons_808080_256x240.png -------------------------------------------------------------------------------- /extension/css/jquery/south-street/images/ui-icons_847e71_256x240.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VojtechVitek/CoNetServ/HEAD/extension/css/jquery/south-street/images/ui-icons_847e71_256x240.png -------------------------------------------------------------------------------- /extension/css/jquery/south-street/images/ui-icons_8dc262_256x240.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VojtechVitek/CoNetServ/HEAD/extension/css/jquery/south-street/images/ui-icons_8dc262_256x240.png -------------------------------------------------------------------------------- /extension/css/jquery/south-street/images/ui-icons_cd0a0a_256x240.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VojtechVitek/CoNetServ/HEAD/extension/css/jquery/south-street/images/ui-icons_cd0a0a_256x240.png -------------------------------------------------------------------------------- /extension/css/jquery/south-street/images/ui-icons_eeeeee_256x240.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VojtechVitek/CoNetServ/HEAD/extension/css/jquery/south-street/images/ui-icons_eeeeee_256x240.png -------------------------------------------------------------------------------- /extension/css/jquery/south-street/images/ui-icons_ffffff_256x240.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VojtechVitek/CoNetServ/HEAD/extension/css/jquery/south-street/images/ui-icons_ffffff_256x240.png -------------------------------------------------------------------------------- /extension/css/jquery/sunny/images/ui-bg_inset-soft_30_ffffff_1x100.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VojtechVitek/CoNetServ/HEAD/extension/css/jquery/sunny/images/ui-bg_inset-soft_30_ffffff_1x100.png -------------------------------------------------------------------------------- /plugin/win/dll_export.def.in: -------------------------------------------------------------------------------- 1 | LIBRARY @PLUGIN_FILENAME@ 2 | 3 | EXPORTS 4 | NP_GetEntryPoints @1 5 | NP_Initialize @2 6 | NP_Shutdown @3 7 | NP_GetMIMEDescription @4 8 | -------------------------------------------------------------------------------- /extension/css/jquery/south-street/images/ui-bg_glass_55_fcf0ba_1x400.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VojtechVitek/CoNetServ/HEAD/extension/css/jquery/south-street/images/ui-bg_glass_55_fcf0ba_1x400.png -------------------------------------------------------------------------------- /extension/css/jquery/sunny/images/ui-bg_gloss-wave_45_817865_500x100.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VojtechVitek/CoNetServ/HEAD/extension/css/jquery/sunny/images/ui-bg_gloss-wave_45_817865_500x100.png -------------------------------------------------------------------------------- /extension/css/jquery/sunny/images/ui-bg_gloss-wave_60_fece2f_500x100.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VojtechVitek/CoNetServ/HEAD/extension/css/jquery/sunny/images/ui-bg_gloss-wave_60_fece2f_500x100.png -------------------------------------------------------------------------------- /extension/css/jquery/sunny/images/ui-bg_gloss-wave_70_ffdd57_500x100.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VojtechVitek/CoNetServ/HEAD/extension/css/jquery/sunny/images/ui-bg_gloss-wave_70_ffdd57_500x100.png -------------------------------------------------------------------------------- /extension/css/jquery/sunny/images/ui-bg_gloss-wave_90_fff9e5_500x100.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VojtechVitek/CoNetServ/HEAD/extension/css/jquery/sunny/images/ui-bg_gloss-wave_90_fff9e5_500x100.png -------------------------------------------------------------------------------- /extension/css/jquery/sunny/images/ui-bg_highlight-soft_100_feeebd_1x100.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VojtechVitek/CoNetServ/HEAD/extension/css/jquery/sunny/images/ui-bg_highlight-soft_100_feeebd_1x100.png -------------------------------------------------------------------------------- /extension/firefox/locale/cs-CZ/conetserv.dtd: -------------------------------------------------------------------------------- 1 | 2 | 3 | -------------------------------------------------------------------------------- /extension/firefox/locale/en-US/conetserv.dtd: -------------------------------------------------------------------------------- 1 | 2 | 3 | -------------------------------------------------------------------------------- /extension/css/jquery/south-street/images/ui-bg_inset-soft_15_2b2922_1x100.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VojtechVitek/CoNetServ/HEAD/extension/css/jquery/south-street/images/ui-bg_inset-soft_15_2b2922_1x100.png -------------------------------------------------------------------------------- /extension/css/jquery/sunny/images/ui-bg_diagonals-medium_20_d34d17_40x40.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VojtechVitek/CoNetServ/HEAD/extension/css/jquery/sunny/images/ui-bg_diagonals-medium_20_d34d17_40x40.png -------------------------------------------------------------------------------- /extension/css/jquery/cupertino/images/ui-bg_diagonals-thick_25_cd0a0a_40x40.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VojtechVitek/CoNetServ/HEAD/extension/css/jquery/cupertino/images/ui-bg_diagonals-thick_25_cd0a0a_40x40.png -------------------------------------------------------------------------------- /extension/css/jquery/cupertino/images/ui-bg_diagonals-thick_50_ffef8f_40x40.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VojtechVitek/CoNetServ/HEAD/extension/css/jquery/cupertino/images/ui-bg_diagonals-thick_50_ffef8f_40x40.png -------------------------------------------------------------------------------- /extension/css/jquery/cupertino/images/ui-bg_diagonals-thick_90_eeeeee_40x40.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VojtechVitek/CoNetServ/HEAD/extension/css/jquery/cupertino/images/ui-bg_diagonals-thick_90_eeeeee_40x40.png -------------------------------------------------------------------------------- /extension/css/jquery/cupertino/images/ui-bg_highlight-hard_100_f2f5f7_1x100.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VojtechVitek/CoNetServ/HEAD/extension/css/jquery/cupertino/images/ui-bg_highlight-hard_100_f2f5f7_1x100.png -------------------------------------------------------------------------------- /extension/css/jquery/cupertino/images/ui-bg_highlight-hard_70_000000_1x100.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VojtechVitek/CoNetServ/HEAD/extension/css/jquery/cupertino/images/ui-bg_highlight-hard_70_000000_1x100.png -------------------------------------------------------------------------------- /extension/css/jquery/cupertino/images/ui-bg_highlight-soft_100_deedf7_1x100.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VojtechVitek/CoNetServ/HEAD/extension/css/jquery/cupertino/images/ui-bg_highlight-soft_100_deedf7_1x100.png -------------------------------------------------------------------------------- /extension/css/jquery/south-street/images/ui-bg_gloss-wave_100_ece8da_500x100.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VojtechVitek/CoNetServ/HEAD/extension/css/jquery/south-street/images/ui-bg_gloss-wave_100_ece8da_500x100.png -------------------------------------------------------------------------------- /extension/css/jquery/south-street/images/ui-bg_highlight-hard_100_f5f3e5_1x100.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VojtechVitek/CoNetServ/HEAD/extension/css/jquery/south-street/images/ui-bg_highlight-hard_100_f5f3e5_1x100.png -------------------------------------------------------------------------------- /extension/css/jquery/south-street/images/ui-bg_highlight-hard_100_fafaf4_1x100.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VojtechVitek/CoNetServ/HEAD/extension/css/jquery/south-street/images/ui-bg_highlight-hard_100_fafaf4_1x100.png -------------------------------------------------------------------------------- /extension/css/jquery/south-street/images/ui-bg_highlight-hard_15_459e00_1x100.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VojtechVitek/CoNetServ/HEAD/extension/css/jquery/south-street/images/ui-bg_highlight-hard_15_459e00_1x100.png -------------------------------------------------------------------------------- /extension/css/jquery/south-street/images/ui-bg_highlight-hard_95_cccccc_1x100.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VojtechVitek/CoNetServ/HEAD/extension/css/jquery/south-street/images/ui-bg_highlight-hard_95_cccccc_1x100.png -------------------------------------------------------------------------------- /extension/css/jquery/south-street/images/ui-bg_highlight-soft_25_67b021_1x100.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VojtechVitek/CoNetServ/HEAD/extension/css/jquery/south-street/images/ui-bg_highlight-soft_25_67b021_1x100.png -------------------------------------------------------------------------------- /extension/css/jquery/south-street/images/ui-bg_highlight-soft_95_ffedad_1x100.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VojtechVitek/CoNetServ/HEAD/extension/css/jquery/south-street/images/ui-bg_highlight-soft_95_ffedad_1x100.png -------------------------------------------------------------------------------- /extension/.gitignore: -------------------------------------------------------------------------------- 1 | # Ignore auto-generated package files 2 | 3 | about.html 4 | 5 | # Chrome: 6 | manifest.json 7 | 8 | # Firefox: 9 | chrome.manifest 10 | install.rdf 11 | 12 | # Opera: 13 | config.xml 14 | 15 | # Platform-dependent files: 16 | platform 17 | -------------------------------------------------------------------------------- /extension/firefox/overlay.css: -------------------------------------------------------------------------------- 1 | #conetservToolButton { 2 | list-style-image: 3 | url(chrome://conetserv/content/images/icon32.png); 4 | } 5 | 6 | toolbar[iconsize="small"] #conetservToolButton { 7 | list-style-image: url(chrome://conetserv/content/images/icon16.png); 8 | } 9 | -------------------------------------------------------------------------------- /plugin/plugin.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #ifndef _PLUGIN_OBJECT_H_ 3 | #define _PLUGIN_OBJECT_H_ 4 | 5 | #include "npapi.h" 6 | 7 | typedef struct _object { 8 | NPObject obj; 9 | NPP instance; 10 | } object; 11 | 12 | extern NPClass pluginClass; 13 | 14 | #endif /*_PLUGIN_OBJECT_H_*/ -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Temporary, backup and hidden files 2 | *~ 3 | *.backup 4 | .* 5 | 6 | # Default build directory 7 | build/ 8 | 9 | # CMake-generated files 10 | CMakeFiles 11 | CMakeCache.txt 12 | cmake_install.cmake 13 | cmake_uninstall.cmake 14 | 15 | # ssh 16 | .ssh/ 17 | 18 | #backup 19 | backup/ 20 | 21 | -------------------------------------------------------------------------------- /plugin/win/shell.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #ifndef _SHELL_H_ 3 | #define _SHELL_H_ 4 | 5 | /* 6 | * Windows shell is CMD.EXE. 7 | * Adapt it's naming convention to an abstract struct SHELL. 8 | */ 9 | #include "cmd_exe.h" 10 | 11 | #define init_shell init_cmd_line 12 | #define shell_module cmd_exe_module 13 | 14 | #define shell cmd_line 15 | 16 | #endif /*_SHELL_H_*/ -------------------------------------------------------------------------------- /plugin/config.h.in: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #ifndef _CONFIG_H_ 3 | #define _CONFIG_H_ 4 | 5 | #define @HAVE_NPAPI_NPSTRING_WHAT_CASE_MEMBERS@ 6 | 7 | #define VERSION "@VERSION@" 8 | #define PLUGIN_NAME "@PLUGIN_NAME@" 9 | #define PLUGIN_LONG "@PLUGIN_LONG@" 10 | #define PLUGIN_DESC "@PLUGIN_DESC@" 11 | #define PLUGIN_MIME "@PLUGIN_TYPE@:@PLUGIN_LOW@:@PLUGIN_LONG@" 12 | 13 | #endif /*_CONFIG_H_*/ 14 | -------------------------------------------------------------------------------- /plugin/debug.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | #include "config.h" 5 | #include "debug.h" 6 | #include "npapi.h" 7 | 8 | #if defined(DEBUG) 9 | 10 | #if defined(_WINDOWS) || defined(__APPLE__) || defined(ANDROID) 11 | FILE *debug_stderr_file; 12 | #endif 13 | 14 | NPUTF8 *debug_identifier_str[DEBUG_IDENTIFIER_COUNT] = {0}; 15 | int debug_identifier_ptr = 0; 16 | 17 | #endif 18 | -------------------------------------------------------------------------------- /plugin/apple/Localized.r.in: -------------------------------------------------------------------------------- 1 | #include 2 | //#include 3 | 4 | // Plugin info 5 | resource 'STR#' (126, "Description") { { "@PLUGIN_LONG@", "@PLUGIN_NAME@" } }; 6 | 7 | // MIME type descriptions 8 | resource 'STR#' (127, "MIME type description") { { "@PLUGIN_DESC@" } }; 9 | 10 | // MIME types 11 | resource 'STR#' (128, "MIME type") { { "@PLUGIN_TYPE@", "" } }; 12 | 13 | -------------------------------------------------------------------------------- /extension/firefox/chrome.manifest.in: -------------------------------------------------------------------------------- 1 | content @PROJECT_LOW@ ./ 2 | overlay chrome://browser/content/browser.xul chrome://@PROJECT_LOW@/content/firefox/overlay.xul 3 | locale @PROJECT_LOW@ en-US firefox/locale/en-US/ 4 | locale @PROJECT_LOW@ cs-CZ firefox/locale/cs-CZ/ 5 | style chrome://browser/content/browser.xul chrome://@PROJECT_LOW@/content/firefox/overlay.css 6 | style chrome://global/content/customizeToolbar.xul chrome://@PROJECT_LOW@/content/firefox/overlay.css 7 | -------------------------------------------------------------------------------- /extension/js/onload.js: -------------------------------------------------------------------------------- 1 | /* 2 | * This file includes functions run after extension page is loaded 3 | */ 4 | 5 | $(document).ready(function(){ 6 | Conetserv.onReady(); 7 | }); 8 | 9 | /* 10 | * Function, which is started after everything has been loaded 11 | */ 12 | $(window).load(function() { 13 | Conetserv.onLoad(); 14 | }); 15 | 16 | /** 17 | * initialize page ui right after page creation 18 | */ 19 | $(function() { 20 | Conetserv.Ui.initialize(); 21 | }); 22 | 23 | -------------------------------------------------------------------------------- /plugin/module.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #ifndef _PLUGIN_MODULE_H_ 3 | #define _PLUGIN_MODULE_H_ 4 | 5 | #include "npapi.h" 6 | #include "plugin.h" 7 | #include "process.h" 8 | 9 | /** Plugin module */ 10 | typedef struct _module { 11 | NPClass class; 12 | NPIdentifier *identifier; 13 | 14 | void (*destroy)(); 15 | } module; 16 | 17 | bool init_modules(); 18 | 19 | extern module *modules; 20 | 21 | NPClass moduleClass; 22 | 23 | #endif /*_PLUGIN_MODULE_H_*/ 24 | -------------------------------------------------------------------------------- /plugin/win/process.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #ifndef _PLUGIN_PROCESS_H_ 3 | #define _PLUGIN_PROCESS_H_ 4 | 5 | #include "npapi.h" 6 | #include "plugin.h" 7 | 8 | /** Windows: Plugin process - struct */ 9 | typedef struct _process { 10 | NPObject obj; 11 | bool running; 12 | 13 | /* Platform-dependent data: */ 14 | HANDLE pid; 15 | HANDLE pipe[2]; 16 | } process; 17 | 18 | extern NPClass processClass; 19 | 20 | #endif /*_PLUGIN_PROCESS_H_*/ 21 | -------------------------------------------------------------------------------- /plugin/unix/process.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #ifndef _PLUGIN_PROCESS_H_ 3 | #define _PLUGIN_PROCESS_H_ 4 | 5 | #include /*pid_t*/ 6 | 7 | #include "npapi.h" 8 | #include "plugin.h" 9 | 10 | /** UNIX: Plugin process - struct */ 11 | typedef struct _process { 12 | NPObject obj; 13 | bool running; 14 | 15 | /* Platform-dependent data: */ 16 | pid_t pid; 17 | int pipe[2]; 18 | } process; 19 | 20 | extern NPClass processClass; 21 | 22 | #endif /*_PLUGIN_PROCESS_H_*/ 23 | -------------------------------------------------------------------------------- /extension/css/sunny.css: -------------------------------------------------------------------------------- 1 | /* 2 | Document : south-street 3 | Created on : 9.6.2010, 13:41:30 4 | Author : kanei 5 | Description: 6 | Stylesheet for Sunny Jquery Ui theme implemented in CoNetServ 7 | */ 8 | 9 | .color1{ 10 | color: orange; 11 | } 12 | 13 | .color2{ 14 | color: #cda827; 15 | } 16 | 17 | .color3{ 18 | color: green; 19 | } 20 | 21 | .ui-icon-close:hover { 22 | background-image: url(images/ui-icons_red_256x240.png); 23 | background-position: -32px -192px; 24 | } 25 | 26 | .ui-state-hover .ui-icon-stop { 27 | background-image: url(images/ui-icons_red_256x240.png); 28 | } -------------------------------------------------------------------------------- /extension/css/south-street.css: -------------------------------------------------------------------------------- 1 | /* 2 | Document : south-street 3 | Created on : 9.6.2010, 13:41:30 4 | Author : kanei 5 | Description: 6 | Stylesheet for South street Jquery Ui theme implemented in CoNetServ 7 | */ 8 | 9 | .color1{ 10 | color: #479f03; 11 | } 12 | 13 | .color2{ 14 | color: green; 15 | } 16 | 17 | .color3{ 18 | color: green; 19 | } 20 | 21 | .ui-icon-close:hover { 22 | background-image: url(images/ui-icons_red_256x240.png); 23 | background-position: -32px -192px; 24 | } 25 | 26 | .ui-state-hover .ui-icon-stop { 27 | background-image: url(images/ui-icons_red_256x240.png); 28 | } -------------------------------------------------------------------------------- /extension/css/cupertino.css: -------------------------------------------------------------------------------- 1 | /* 2 | Document : cupertino 3 | Created on : 9.6.2010, 13:40:14 4 | Author : kanei 5 | Description: 6 | Stylesheet for cupetino Jquery Ui theme implemented in CoNetServ 7 | */ 8 | 9 | /* content styling */ 10 | .color1{ 11 | color: #2779aa; 12 | } 13 | 14 | .color2{ 15 | color: blue; 16 | } 17 | 18 | .color3{ 19 | color: green; 20 | } 21 | 22 | 23 | .ui-icon-close:hover { 24 | background-image: url(images/ui-icons_red_256x240.png); 25 | background-position: -32px -192px; 26 | } 27 | 28 | .ui-state-hover .ui-icon-stop { 29 | background-image: url(images/ui-icons_red_256x240.png); 30 | } -------------------------------------------------------------------------------- /extension/chrome/manifest.json.in: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@PROJECT_LONG@", 3 | "version": "@VERSION@", 4 | "description": "@EXTENSION_DESC@", 5 | "icons": { 6 | "16": "images/icon16.png", 7 | "32": "images/icon32.png", 8 | "48": "images/icon48.png", 9 | "128": "images/icon128.png" 10 | }, 11 | "browser_action": { 12 | "default_icon": "images/icon16.png", 13 | "default_title": "@PROJECT_NAME@", 14 | "popup": "index.html" 15 | }, 16 | "minimum_chrome_version": "4.0", 17 | "options_page": "index.html#settings", 18 | "permissions": [ 19 | "http://*/", 20 | "https://*/", 21 | "tabs" 22 | ], 23 | "plugins": [ 24 | @CHROME_LIBRARIES@ 25 | ] 26 | } 27 | -------------------------------------------------------------------------------- /plugin/win/resource.h: -------------------------------------------------------------------------------- 1 | //{{NO_DEPENDENCIES}} 2 | // Microsoft Visual C++ generated include file. 3 | // Used by resource.rc 4 | // 5 | #define IDD_MAIN 101 6 | #define IDC_BUTTON_GO 1002 7 | #define IDC_STATIC_UA 1003 8 | #define IDC_BUTTON1 1005 9 | #define IDC_BUTTON_DONT 1005 10 | 11 | // Next default values for new objects 12 | // 13 | #ifdef APSTUDIO_INVOKED 14 | #ifndef APSTUDIO_READONLY_SYMBOLS 15 | #define _APS_NEXT_RESOURCE_VALUE 102 16 | #define _APS_NEXT_COMMAND_VALUE 40001 17 | #define _APS_NEXT_CONTROL_VALUE 1006 18 | #define _APS_NEXT_SYMED_VALUE 101 19 | #endif 20 | #endif 21 | -------------------------------------------------------------------------------- /plugin/win/init_modules.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #ifndef _INIT_MODULES_H_ 3 | #define _INIT_MODULES_H_ 4 | 5 | #include "module.h" 6 | #include "shell.h" 7 | 8 | #define MODULE_PING 9 | module *ping; 10 | bool init_module_ping(); 11 | 12 | #define MODULE_PING6 13 | module *ping6; 14 | bool init_module_ping6(); 15 | 16 | #define MODULE_TRACEROUTE 17 | module *traceroute; 18 | bool init_module_traceroute(); 19 | 20 | #define MODULE_TRACEROUTE6 21 | module *traceroute6; 22 | bool init_module_traceroute6(); 23 | 24 | #define MODULE_NSLOOKUP 25 | module *nslookup; 26 | bool init_module_nslookup(); 27 | 28 | #define MODULE_NMAP 29 | module *nmap; 30 | bool init_module_nmap(); 31 | 32 | #define MODULE_IPCONFIG 33 | module *ipconfig; 34 | bool init_module_ipconfig(); 35 | 36 | #endif /*_INIT_MODULES_H_*/ -------------------------------------------------------------------------------- /extension/opera/config.xml.in: -------------------------------------------------------------------------------- 1 | 2 | 3 | @PROJECT_LONG@ 4 | @EXTENSION_DESC@ 5 | 6 | @PROJECT_HOST@ 7 | @PROJECT_NAME@ 8 | @BUILD_DATE@ 9 | 10 | images/icon16.png 11 | images/icon32.png 12 | images/icon48.png 13 | images/icon128.png 14 | 680 15 | 560 16 | 17 | @PROJECT_COMPANY@ 18 | @EXTENSION_ID@ 19 | @PROJECT_URL@ 20 | @PROJECT_COMPANY@ 21 | 22 | 23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /plugin/unix/shell.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #ifndef _SHELL_H_ 3 | #define _SHELL_H_ 4 | 5 | #include "npapi.h" 6 | #include "module.h" 7 | #include "process.h" 8 | 9 | #define BUFLEN 1024 10 | 11 | typedef struct _shell_module { 12 | module m; 13 | bool found; 14 | char *path; 15 | } shell_module; 16 | 17 | typedef struct _cmd_shell { 18 | char *(*find)(const char *program); 19 | shell_module *(*init_module)(const char* name); 20 | void (*destroy_module)(shell_module *m); 21 | bool (*run)(process *p, const char *path, char *const argv[]); 22 | bool (*read)(process *p, NPVariant *result); 23 | bool (*stop)(process *p); 24 | void (*destroy)(); 25 | } cmd_shell; 26 | 27 | bool init_shell(); 28 | 29 | extern cmd_shell *shell; 30 | 31 | #endif /*_SHELL_H_*/ 32 | -------------------------------------------------------------------------------- /plugin/win/cmd_exe.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #ifndef _CMD_EXE_H_ 3 | #define _CMD_EXE_H_ 4 | 5 | #include "npapi.h" 6 | #include "module.h" 7 | #include "process.h" 8 | 9 | #define BUFLEN 1024 10 | #define BUFLEN_WCHAR (4 * BUFLEN) 11 | #define BUFLEN_UTF8 (4 * BUFLEN) 12 | 13 | typedef struct _cmd_exe_module { 14 | module m; 15 | bool found; 16 | } cmd_exe_module; 17 | 18 | typedef struct _cmd_exe { 19 | cmd_exe_module *(*init_module)(const char* name); 20 | void (*destroy_module)(cmd_exe_module *m); 21 | bool (*run)(process *p, const char *cmd); 22 | bool (*read)(process *p, NPVariant *result); 23 | bool (*stop)(process *p); 24 | void (*destroy)(); 25 | } cmd_exe; 26 | 27 | bool init_cmd_line(); 28 | 29 | extern cmd_exe *cmd_line; 30 | 31 | #endif /*_CMD_EXE_H_*/ 32 | -------------------------------------------------------------------------------- /CMakePlugins/FindXULRunnerSDK.cmake: -------------------------------------------------------------------------------- 1 | # Locate XULRunner SDK (development headers) 2 | # This module defines: 3 | # XULRunnerSDK_FOUND ("YES" or not defined) 4 | # XULRunnerSDK_INCLUDE_DIR (path to find the headers) 5 | 6 | # If the path is not explicitly defined, try to find it manually 7 | if(NOT XULRunnerSDK_INCLUDE_DIR) 8 | 9 | file(GLOB path1 "/usr/include/xulrunner-*") 10 | 11 | find_path(XULRunnerSDK_INCLUDE_DIR npapi.h 12 | ${path1} 13 | ${path1}/stable 14 | ${path1}/unstable 15 | ) 16 | 17 | endif() 18 | 19 | # Test header file and set final variable if found 20 | if(XULRunnerSDK_INCLUDE_DIR AND EXISTS "${XULRunnerSDK_INCLUDE_DIR}/npapi.h") 21 | set(NPAPI_INCLUDE_DIR ${XULRunnerSDK_INCLUDE_DIR}) 22 | set(XULRunnerSDK_FOUND "YES") 23 | else() 24 | message(FATAL_ERROR "Be sure to specify ABSOLUTE path of INCLUDE directory of XULRunnerSDK.") 25 | endif() 26 | -------------------------------------------------------------------------------- /plugin/unix/init_modules.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #ifndef _INIT_MODULES_H_ 3 | #define _INIT_MODULES_H_ 4 | 5 | #include "module.h" 6 | #include "shell.h" 7 | 8 | #define MODULE_PING 9 | module *ping; 10 | bool init_module_ping(); 11 | 12 | #define MODULE_PING6 13 | module *ping6; 14 | bool init_module_ping6(); 15 | 16 | #define MODULE_TRACEROUTE 17 | module *traceroute; 18 | bool init_module_traceroute(); 19 | 20 | #define MODULE_TRACEROUTE6 21 | module *traceroute6; 22 | bool init_module_traceroute6(); 23 | 24 | #define MODULE_NSLOOKUP 25 | module *nslookup; 26 | bool init_module_nslookup(); 27 | 28 | #define MODULE_WHOIS 29 | module *whois; 30 | bool init_module_whois(); 31 | 32 | #define MODULE_DIG 33 | module *dig; 34 | bool init_module_dig(); 35 | 36 | #define MODULE_NMAP 37 | module *nmap; 38 | bool init_module_nmap(); 39 | 40 | #define MODULE_IPCONFIG 41 | module *ipconfig; 42 | bool init_module_ipconfig(); 43 | 44 | #endif /*_INIT_MODULES_H_*/ -------------------------------------------------------------------------------- /plugin/unix/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # CoNetServ plugin - Unix-like systems 2 | 3 | # File is included -> current path is ../ 4 | include_directories(unix) 5 | 6 | set(sources 7 | ${sources} 8 | unix/shell.c 9 | unix/ping.c 10 | unix/traceroute.c 11 | unix/nslookup.c 12 | unix/whois.c 13 | unix/dig.c 14 | unix/nmap.c 15 | unix/ifconfig.c 16 | unix/route.c 17 | ) 18 | 19 | set(headers 20 | ${headers} 21 | unix/init_modules.h 22 | unix/process.h 23 | unix/shell.h 24 | ) 25 | 26 | add_definitions(-std=gnu99) 27 | if("${CMAKE_BUILD_TYPE}" STREQUAL "Release") 28 | add_definitions(-O2) 29 | else() 30 | add_definitions(-g) 31 | endif() 32 | 33 | find_package(XULRunnerSDK REQUIRED) 34 | if(NOT "${XULRunnerSDK_FOUND}" STREQUAL "YES") 35 | message(FATAL_ERROR "Please install XULRunner SDK (xulrunner-devel>=1.9).") 36 | endif() 37 | message(STATUS "XULRunner SDK found: ${XULRunnerSDK_INCLUDE_DIR}") 38 | include_directories(${XULRunnerSDK_INCLUDE_DIR}) 39 | add_definitions(-DXULRUNNER_SDK) 40 | -------------------------------------------------------------------------------- /extension/firefox/install.rdf.in: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | @EXTENSION_ID@ 5 | 2 6 | @PROJECT_LONG@ 7 | @VERSION@ 8 | @FIREFOX_LIBRARIES@ 9 | @EXTENSION_DESC@ 10 | @PROJECT_COMPANY@ 11 | @PROJECT_URL@ 12 | chrome://@PROJECT_LOW@/content/images/icon32.png 13 | 14 | 15 | 16 | 17 | {ec8030f7-c20a-464f-9b0e-13a3a9e97384} 18 | 3.0 19 | 3.6.* 20 | 21 | 22 | @FIREFOX_AUTHORS@ 23 | 24 | 25 | -------------------------------------------------------------------------------- /plugin/apple/Info.plist.in: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | English 7 | CFBundleExecutable 8 | @PLUGIN_FILENAME@ 9 | CFBundleName 10 | @PLUGIN_NAME@ 11 | CFBundleGetInfoString 12 | @PLUGIN_LONG@ 13 | CFBundleIdentifier 14 | @PLUGIN_ID@ 15 | CFBundleInfoDictionaryVersion 16 | 6.0 17 | CFBundlePackageType 18 | BRPL 19 | CFBundleShortVersionString 20 | @VERSION@ 21 | CFBundleSignature 22 | ???? 23 | CFBundleVersion 24 | @VERSION@ 25 | CFPlugInDynamicRegisterFunction 26 | 27 | CFPlugInDynamicRegistration 28 | YES 29 | 30 | -------------------------------------------------------------------------------- /plugin/win/stdbool.h: -------------------------------------------------------------------------------- 1 | /* Copyright (C) 2008 Free Software Foundation, Inc. 2 | Written by Adam Strzelecki 3 | 4 | This program is free software; you can redistribute it and/or 5 | modify it under the terms of the GNU Lesser General Public License 6 | as published by the Free Software Foundation; either version 2.1, 7 | or (at your option) any later version. 8 | 9 | This program is distributed in the hope that it will be useful, but 10 | WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 | Lesser General Public License for more details. 13 | 14 | You should have received a copy of the GNU Lesser General Public 15 | License along with this program; if not, write to the Free Software 16 | Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 17 | 02110-1301, USA. */ 18 | 19 | #ifndef _STDBOOL_H 20 | #define _STDBOOL_H 21 | 22 | #define _Bool signed char 23 | enum { false = 0, true = 1 }; 24 | #define bool _Bool 25 | #define false 0 26 | #define true 1 27 | #define __bool_true_false_are_defined 1 28 | 29 | #endif /* _STDBOOL_H */ 30 | -------------------------------------------------------------------------------- /CMakePlugins/MozillaTargetPlatform.cmake: -------------------------------------------------------------------------------- 1 | # Mozilla - structure of Installable Bundle 2 | # https://developer.mozilla.org/en/Bundles#Platform-specific_Subdirectories 3 | 4 | if(APPLE) 5 | set(MOZILLA_PLATFORM Darwin) 6 | set(MOZILLA_COMPILER gcc3) 7 | elseif(WIN32) 8 | set(MOZILLA_PLATFORM WINNT) 9 | set(MOZILLA_COMPILER msvc) 10 | elseif("${CMAKE_SYSTEM_NAME}" STREQUAL "Linux") 11 | set(MOZILLA_PLATFORM Linux) 12 | set(MOZILLA_COMPILER gcc3) 13 | elseif("${CMAKE_SYSTEM_NAME}" STREQUAL "FreeBSD") 14 | set(MOZILLA_PLATFORM FreeBSD) 15 | set(MOZILLA_COMPILER gcc3) 16 | else() 17 | message(FATAL_ERROR "Not implemented for ${CMAKE_SYSTEM_NAME} yet.") 18 | endif() 19 | 20 | if("${ARCH}" STREQUAL "") 21 | if(${CMAKE_SYSTEM_PROCESSOR} STREQUAL "i386") 22 | set(MOZILLA_ARCH "x86") 23 | elseif(${CMAKE_SYSTEM_PROCESSOR} STREQUAL "i686") 24 | set(MOZILLA_ARCH "x86") 25 | elseif(${CMAKE_SYSTEM_PROCESSOR} STREQUAL "powerpc") 26 | set(MOZILLA_ARCH "ppc") 27 | else() 28 | set(MOZILLA_ARCH ${CMAKE_SYSTEM_PROCESSOR}) 29 | endif() 30 | else() 31 | set(MOZILLA_ARCH ${ARCH}) 32 | endif() 33 | 34 | set(MOZILLA_TARGET "${MOZILLA_PLATFORM}_${MOZILLA_ARCH}-${MOZILLA_COMPILER}") 35 | set(MOZILLA_PATH "platform/${MOZILLA_TARGET}/plugins") 36 | -------------------------------------------------------------------------------- /plugin/win/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # CoNetServ plugin - Windows 2 | 3 | # File is included -> current path is ../ 4 | include_directories(win) 5 | 6 | set(PLUGIN_FILENAME "np${PROJECT_NAME}.dll") 7 | configure_file("win/dll_export.def.in" "${CMAKE_BINARY_DIR}/dll_export.def" IMMEDIATE @ONLY) 8 | configure_file("win/resource.rc.in" "${CMAKE_BINARY_DIR}/resource.rc" IMMEDIATE @ONLY) 9 | 10 | set(sources 11 | ${sources} 12 | ${CMAKE_BINARY_DIR}/dll_export.def 13 | ${CMAKE_BINARY_DIR}/resource.rc 14 | win/cmd_exe.c 15 | win/ping.c 16 | win/tracert.c 17 | win/nslookup.c 18 | win/nmap.c 19 | win/ipconfig.c 20 | ) 21 | 22 | set(headers 23 | ${headers} 24 | win/cmd_exe.h 25 | win/init_modules.h 26 | win/process.h 27 | win/resource.h 28 | win/shell.h 29 | win/stdbool.h 30 | ) 31 | 32 | find_package(XULRunnerSDK REQUIRED) 33 | if(NOT "${XULRunnerSDK_FOUND}" STREQUAL "YES") 34 | message(FATAL_ERROR "Set XULRunnerSDK_INCLUDE_DIR variable to path of your XULRunner SDK include directory.\nFor downloading XULRunner SDK, visit https://developer.mozilla.org/en/Gecko_SDK#Downloading") 35 | endif() 36 | message(STATUS "XULRunner SDK found: ${XULRunnerSDK_INCLUDE_DIR}") 37 | include_directories(${XULRunnerSDK_INCLUDE_DIR}) 38 | add_definitions(-DXULRUNNER_SDK) 39 | -------------------------------------------------------------------------------- /extension/firefox/overlay.xul: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 10 | 11 | 12 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 23 | 24 | 25 | -------------------------------------------------------------------------------- /plugin/apple/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # CoNetServ plugin - Apple (Darwin) 2 | 3 | # NOTE: File is using special variables from ../CMakeLists.txt 4 | # File is included -> current path is ../ 5 | 6 | # Make MacOS bundle plugin directory 7 | set(PLATFORM_PATH np${PROJECT_NAME}.plugin/Contents/MacOS/) 8 | file(MAKE_DIRECTORY ${RELEASE_DIR}/${MOZILLA_PATH}np${PROJECT_NAME}.plugin/Contents/Resources/English.lproj) 9 | file(MAKE_DIRECTORY ${RELEASE_DIR}/${MOZILLA_PATH}np${PROJECT_NAME}.plugin/Contents/MacOS) 10 | configure_file("apple/Info.plist.in" "${RELEASE_DIR}/${MOZILLA_PATH}np${PROJECT_NAME}.plugin/Contents/MacOS/Info.plist") 11 | configure_file("apple/Localized.r.in" "${CMAKE_BINARY_DIR}/Localized.r") 12 | find_program(APPLE_RESOURCE Rez /Developer/Tools) 13 | if(APPLE_RESOURCE) 14 | add_custom_command(OUTPUT ${RELEASE_DIR}/${MOZILLA_PATH}np${PROJECT_NAME}.plugin/Contents/Resources/English.lproj/Localized.rsrc 15 | COMMAND ${APPLE_RESOURCE} 16 | -o ${RELEASE_DIR}/${MOZILLA_PATH}np${PROJECT_NAME}.plugin/Contents/Resources/English.lproj/Localized.rsrc 17 | -useDF ${CMAKE_BINARY_DIR}/Localized.r 18 | COMMENT "Generating MacOSX resource files and plugin directory structure." 19 | DEPENDS ${CMAKE_BINARY_DIR}/Localized.r) 20 | 21 | add_custom_target(MacOSXResFiles ALL 22 | DEPENDS ${RELEASE_DIR}/${MOZILLA_PATH}np${PROJECT_NAME}.plugin/Contents/Resources/English.lproj/Localized.rsrc) 23 | else() 24 | message(FATAL_ERROR "Can't find /Developer/Tools/Rez.") 25 | endif() -------------------------------------------------------------------------------- /CMakePlugins/NPAPI_NPString_members.cmake: -------------------------------------------------------------------------------- 1 | include(CheckCSourceCompiles) 2 | 3 | set(CMAKE_REQUIRED_INCLUDES ${NPAPI_INCLUDE_DIR}) 4 | 5 | CHECK_C_SOURCE_COMPILES(" 6 | #if defined(_WINDOWS) 7 | #define _X86_ 8 | #define bool int 9 | #endif 10 | #include 11 | #if !defined(__APPLE__) 12 | #include 13 | #endif 14 | #include 15 | int main() 16 | { 17 | NPString str; 18 | str.UTF8Characters = 0; 19 | str.UTF8Length = 0; 20 | return 0; 21 | } 22 | " HAVE_NPAPI_NPSTRING_CAMEL_CASE_MEMBERS) 23 | 24 | CHECK_C_SOURCE_COMPILES(" 25 | #if defined(_WINDOWS) 26 | #define _X86_ 27 | #define bool int 28 | #endif 29 | #include 30 | #if !defined(__APPLE__) 31 | #include 32 | #endif 33 | #include 34 | int main() 35 | { 36 | NPString str; 37 | str.utf8characters = 0; 38 | str.utf8length = 0; 39 | return 0; 40 | } 41 | " HAVE_NPAPI_NPSTRING_LOWER_CASE_MEMBERS) 42 | 43 | set(CMAKE_REQUIRED_INCLUDES) 44 | 45 | if(NOT "${HAVE_NPAPI_NPSTRING_CAMEL_CASE_MEMBERS}" STREQUAL "") 46 | set(HAVE_NPAPI_NPSTRING_WHAT_CASE_MEMBERS "HAVE_NPAPI_NPSTRING_CAMEL_CASE_MEMBERS") 47 | message(STATUS "NPAPI NPString members recognized as CAMEL CASE") 48 | elseif(NOT "${HAVE_NPAPI_NPSTRING_LOWER_CASE_MEMBERS}" STREQUAL "") 49 | set(HAVE_NPAPI_NPSTRING_WHAT_CASE_MEMBERS "HAVE_NPAPI_NPSTRING_LOWER_CASE_MEMBERS") 50 | message(STATUS "NPAPI NPString members recognized as LOWER CASE") 51 | else() 52 | message(FATAL_ERROR "NPAPI NPString members couldn't be recognized.") 53 | endif() 54 | -------------------------------------------------------------------------------- /extension/test.html: -------------------------------------------------------------------------------- 1 | 2 | 49 | 50 | Data: 51 | 53 | 55 |
56 | 57 | 58 | 59 | 60 | 61 | -------------------------------------------------------------------------------- /plugin/identifier.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #ifndef _IDENTIFIER_H_ 3 | #define _IDENTIFIER_H_ 4 | 5 | #include "npapi.h" 6 | #include "init_modules.h" 7 | 8 | typedef struct _identifier { 9 | NPIdentifier read; 10 | NPIdentifier start; 11 | NPIdentifier stop; 12 | 13 | NPIdentifier running; 14 | NPIdentifier version; 15 | NPIdentifier found; 16 | 17 | #ifdef MODULE_PING 18 | NPIdentifier ping; 19 | #endif 20 | 21 | #ifdef MODULE_PING6 22 | NPIdentifier ping6; 23 | #endif 24 | 25 | #if defined(MODULE_PING) || defined(MODULE_PING6) 26 | NPIdentifier count; 27 | NPIdentifier timeout; 28 | NPIdentifier packetsize; 29 | NPIdentifier ttl; 30 | #endif 31 | 32 | #ifdef MODULE_TRACEROUTE 33 | NPIdentifier tracert; 34 | NPIdentifier traceroute; 35 | #endif 36 | 37 | #ifdef MODULE_TRACEROUTE6 38 | NPIdentifier tracert6; 39 | NPIdentifier traceroute6; 40 | #endif 41 | 42 | #if defined(MODULE_TRACEROUTE) || defined(MODULE_TRACEROUTE6) 43 | NPIdentifier maxhops; 44 | NPIdentifier waittime; 45 | NPIdentifier iptohostname; 46 | #endif 47 | 48 | #ifdef MODULE_NSLOOKUP 49 | NPIdentifier nslookup; 50 | #endif 51 | 52 | #if defined(MODULE_NSLOOKUP) || defined(MODULE_NMAP) 53 | NPIdentifier query; 54 | #endif 55 | 56 | #ifdef MODULE_WHOIS 57 | NPIdentifier whois; 58 | #endif 59 | 60 | #ifdef MODULE_DIG 61 | NPIdentifier dig; 62 | #endif 63 | 64 | #ifdef MODULE_NMAP 65 | NPIdentifier nmap; 66 | #endif 67 | 68 | #ifdef MODULE_IPCONFIG 69 | NPIdentifier ipconfig; 70 | NPIdentifier ifconfig; 71 | #endif 72 | 73 | void (*destroy)(); 74 | } identifier; 75 | 76 | bool init_identifiers(); 77 | 78 | extern identifier *identifiers; 79 | 80 | #endif /*_IDENTIFIER_H_*/ 81 | -------------------------------------------------------------------------------- /extension/js/firefox.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Object containing functions for Firefox browser 3 | */ 4 | var Firefox = { 5 | appendButtonInToolbar:function(buttonId, toolbarId) { 6 | var toolbar = document.getElementById(toolbarId); 7 | var button = document.getElementById(buttonId); 8 | var before = document.getElementById("urlbar-container"); 9 | if(button) { 10 | var parentBar = button.parentNode; 11 | if(parentBar && parentBar != toolbar) { 12 | var newset = this.removeButtonFromToolbarCurrentSet(parentBar,buttonId); 13 | } 14 | toolbar.insertBefore(button, before); 15 | }else{ 16 | toolbar.insertItem(buttonId); 17 | } 18 | 19 | this.appendButtonInToolbarCurrentSet(toolbar,buttonId); 20 | }, 21 | 22 | appendButtonInToolbarCurrentSet:function(toolbar, buttonId) { 23 | var oldset = toolbar.getAttribute("currentset"); 24 | var newset = ""; 25 | if(oldset && oldset!="") { 26 | newset = oldset + ","; 27 | } 28 | newset += buttonId; 29 | toolbar.setAttribute("currentset", newset); 30 | document.persist(toolbar.id,"currentset"); 31 | return newset; 32 | }, 33 | 34 | 35 | removeButtonFromToolbarCurrentSet:function(toolbar, buttonId) { 36 | var oldset = toolbar.getAttribute("currentset"); 37 | if(!oldset || oldset=="" || oldset.indexOf(buttonId) == -1) return oldset; 38 | var reg = new RegExp(buttonId+",?", "gi"); 39 | var newset = oldset.replace(reg,""); 40 | if (newset.charAt(newset.length-1) == ",") { 41 | newset = newset.substring(0, newset.length - 1); 42 | } 43 | 44 | toolbar.setAttribute("currentset", newset); 45 | document.persist(toolbar.id,"currentset"); 46 | return newset; 47 | } 48 | } 49 | 50 | -------------------------------------------------------------------------------- /plugin/win/resource.rc.in: -------------------------------------------------------------------------------- 1 | // Microsoft Visual C++ generated resource script. 2 | #include "resource.h" 3 | 4 | #define APSTUDIO_READONLY_SYMBOLS 5 | #include "winresrc.h" 6 | #undef APSTUDIO_READONLY_SYMBOLS 7 | 8 | #if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) 9 | 10 | #ifdef _WIN32 11 | LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US 12 | #pragma code_page(1252) 13 | #endif //_WIN32 14 | 15 | VS_VERSION_INFO VERSIONINFO 16 | FILEVERSION @MAJOR_VERSION@,@MINOR_VERSION@,0,0 17 | PRODUCTVERSION @MAJOR_VERSION@,@MINOR_VERSION@,0,0 18 | FILEFLAGSMASK 0x3fL 19 | #ifdef _DEBUG 20 | FILEFLAGS 0x1L 21 | #else 22 | FILEFLAGS 0x0L 23 | #endif 24 | FILEOS 0x40004L 25 | FILETYPE 0x2L 26 | FILESUBTYPE 0x0L 27 | BEGIN 28 | BLOCK "StringFileInfo" 29 | BEGIN 30 | BLOCK "040904e4" 31 | BEGIN 32 | VALUE "CompanyName", "@PROJECT_COMPANY@" 33 | VALUE "FileDescription", "@PLUGIN_DESC@" 34 | VALUE "FileOpenName", "@PROJECT_LONG@" 35 | VALUE "FileVersion", "@VERSION@" 36 | VALUE "InternalName", "@PROJECT_NAME@" 37 | VALUE "LegalCopyright", "@PROJECT_COPY@" 38 | VALUE "MIMEType", "@PLUGIN_TYPE@" 39 | VALUE "OriginalFilename", "@PLUGIN_FILENAME@" 40 | VALUE "ProductName", "@PROJECT_NAME@" 41 | VALUE "ProductVersion", "@VERSION@" 42 | END 43 | END 44 | BLOCK "VarFileInfo" 45 | BEGIN 46 | VALUE "Translation", 0x409, 1252 47 | END 48 | END 49 | 50 | #ifdef APSTUDIO_INVOKED 51 | 1 TEXTINCLUDE 52 | BEGIN 53 | "resource.h\0" 54 | END 55 | 56 | 2 TEXTINCLUDE 57 | BEGIN 58 | "#include ""winresrc.h""\r\n" 59 | "\0" 60 | END 61 | 62 | 3 TEXTINCLUDE 63 | BEGIN 64 | "\r\n" 65 | "\0" 66 | END 67 | #endif // APSTUDIO_INVOKED 68 | 69 | #endif // English (U.S.) resources -------------------------------------------------------------------------------- /plugin/common/route.c: -------------------------------------------------------------------------------- 1 | /* ROUTE module */ 2 | module *route = NULL; 3 | 4 | /** 5 | * Object ROUTE 6 | * Used to distinguish ROUTE object passed from JavaScript 7 | */ 8 | typedef struct _object_route { 9 | object obj; 10 | } object_route; 11 | 12 | /** 13 | * ROUTE settings 14 | */ 15 | /* 16 | static struct { 17 | } settings = {0}; 18 | */ 19 | 20 | static bool 21 | hasProperty(NPObject *obj, NPIdentifier identifier) 22 | { 23 | if (identifier == identifiers->found) { 24 | DEBUG_STR("plugin->route->hasProperty(%s): true", DEBUG_IDENTIFIER(identifier)); 25 | return true; 26 | } 27 | DEBUG_STR("plugin->route->hasProperty(%s): false", DEBUG_IDENTIFIER(identifier)); 28 | return false; 29 | } 30 | 31 | static bool 32 | getProperty(NPObject *obj, NPIdentifier identifier, NPVariant *value) 33 | { 34 | if (identifier == identifiers->found) { 35 | DEBUG_STR("plugin->route->getProperty(%s): true", DEBUG_IDENTIFIER(identifier)); 36 | BOOLEAN_TO_NPVARIANT(((shell_module *)route)->found, *value); 37 | return true; 38 | } 39 | DEBUG_STR("plugin->route->getProperty(%s): false", DEBUG_IDENTIFIER(identifier)); 40 | return false; 41 | } 42 | 43 | static bool 44 | setProperty(NPObject *obj, NPIdentifier identifier, const NPVariant *value) 45 | { 46 | DEBUG_STR("plugin->route->setProperty(%s): false", DEBUG_IDENTIFIER(identifier)); 47 | return false; 48 | } 49 | 50 | static void 51 | destroy() 52 | { 53 | DEBUG_STR("route->destroy()"); 54 | if (route) 55 | shell->destroy_module((shell_module *)route); 56 | } 57 | 58 | static NPObject * 59 | allocate(NPP instance, NPClass *class) 60 | { 61 | object_route *obj; 62 | 63 | DEBUG_STR("plugin->route->allocate()"); 64 | 65 | obj = browser->memalloc(sizeof(*obj)); 66 | ((object *)obj)->instance = instance; 67 | 68 | return (NPObject *)obj; 69 | } 70 | -------------------------------------------------------------------------------- /plugin/unix/route.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | #include "debug.h" 4 | #include "identifier.h" 5 | #include "init_modules.h" 6 | #include "module.h" 7 | #include "npapi.h" 8 | #include "shell.h" 9 | 10 | /* 11 | * !!! 12 | * Include common part for all systems. 13 | * !!! 14 | */ 15 | #include "../common/route.c" 16 | 17 | static bool 18 | invokeMethod(NPObject *obj, NPIdentifier identifier, const NPVariant *args, uint32_t argc, NPVariant *result) 19 | { 20 | char *argv[20]; 21 | int i; 22 | char *ptr; 23 | 24 | if (identifier == identifiers->start) { 25 | 26 | DEBUG_STR("plugin->route->invokeMethod(%s): true", DEBUG_IDENTIFIER(identifier)); 27 | 28 | /* No argument can be passed from JavaScript */ 29 | if (argc != 0) 30 | return false; 31 | 32 | /* First argument should be command path/name */ 33 | i = 0; 34 | argv[i++] = ((shell_module *)route)->path; 35 | 36 | /* Set NULL-terminating argument */ 37 | argv[i++] = NULL; 38 | 39 | OBJECT_TO_NPVARIANT(browser->createobject(((object *)obj)->instance, &processClass), *result); 40 | 41 | if (shell->run((process *)result->value.objectValue, ((shell_module *)route)->path, argv)) 42 | return true; 43 | else 44 | return false; 45 | } 46 | 47 | DEBUG_STR("plugin->route->invokeMethod(%s): false", DEBUG_IDENTIFIER(identifier)); 48 | return false; 49 | } 50 | 51 | bool 52 | init_module_route() 53 | { 54 | DEBUG_STR("route->init()"); 55 | route = (module *)shell->init_module("route"); 56 | route->destroy = destroy; 57 | route->class = modules->class; 58 | route->class.allocate = allocate; 59 | route->class.invoke = invokeMethod; 60 | route->class.hasProperty = hasProperty; 61 | route->class.getProperty = getProperty; 62 | route->class.setProperty = setProperty; 63 | 64 | return true; 65 | } 66 | -------------------------------------------------------------------------------- /plugin/common/ipconfig.c: -------------------------------------------------------------------------------- 1 | /* IPCONFIG module */ 2 | module *ipconfig = NULL; 3 | 4 | /** 5 | * Object IPCONFIG 6 | * Used to distinguish IPCONFIG object passed from JavaScript 7 | */ 8 | typedef struct _object_ipconfig { 9 | object obj; 10 | } object_ipconfig; 11 | 12 | /** 13 | * IPCONFIG settings 14 | */ 15 | /* 16 | static struct { 17 | } settings = {0}; 18 | */ 19 | 20 | static bool 21 | hasProperty(NPObject *obj, NPIdentifier identifier) 22 | { 23 | if (identifier == identifiers->found) { 24 | DEBUG_STR("plugin->ipconfig->hasProperty(%s): true", DEBUG_IDENTIFIER(identifier)); 25 | return true; 26 | } 27 | DEBUG_STR("plugin->ipconfig->hasProperty(%s): false", DEBUG_IDENTIFIER(identifier)); 28 | return false; 29 | } 30 | 31 | static bool 32 | getProperty(NPObject *obj, NPIdentifier identifier, NPVariant *value) 33 | { 34 | if (identifier == identifiers->found) { 35 | DEBUG_STR("plugin->ipconfig->getProperty(%s): true", DEBUG_IDENTIFIER(identifier)); 36 | BOOLEAN_TO_NPVARIANT(((shell_module *)ipconfig)->found, *value); 37 | return true; 38 | } 39 | DEBUG_STR("plugin->ipconfig->getProperty(%s): false", DEBUG_IDENTIFIER(identifier)); 40 | return false; 41 | } 42 | 43 | static bool 44 | setProperty(NPObject *obj, NPIdentifier identifier, const NPVariant *value) 45 | { 46 | DEBUG_STR("plugin->ipconfig->setProperty(%s): false", DEBUG_IDENTIFIER(identifier)); 47 | return false; 48 | } 49 | 50 | static void 51 | destroy() 52 | { 53 | DEBUG_STR("ipconfig->destroy()"); 54 | if (ipconfig) 55 | shell->destroy_module((shell_module *)ipconfig); 56 | } 57 | 58 | static NPObject * 59 | allocate(NPP instance, NPClass *class) 60 | { 61 | object_ipconfig *obj; 62 | 63 | DEBUG_STR("plugin->ipconfig->allocate()"); 64 | 65 | obj = browser->memalloc(sizeof(*obj)); 66 | ((object *)obj)->instance = instance; 67 | 68 | return (NPObject *)obj; 69 | } 70 | -------------------------------------------------------------------------------- /plugin/unix/ifconfig.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | #include "debug.h" 4 | #include "identifier.h" 5 | #include "init_modules.h" 6 | #include "module.h" 7 | #include "npapi.h" 8 | #include "shell.h" 9 | 10 | /* 11 | * !!! 12 | * Include common part for all systems. 13 | * !!! 14 | */ 15 | #include "../common/ipconfig.c" 16 | 17 | static bool 18 | invokeMethod(NPObject *obj, NPIdentifier identifier, const NPVariant *args, uint32_t argc, NPVariant *result) 19 | { 20 | char *argv[20]; 21 | int i; 22 | char *ptr; 23 | 24 | if (identifier == identifiers->start) { 25 | 26 | DEBUG_STR("plugin->ipconfig->invokeMethod(%s): true", DEBUG_IDENTIFIER(identifier)); 27 | 28 | /* No argument can be passed from JavaScript */ 29 | if (argc != 0) 30 | return false; 31 | 32 | /* First argument should be command path/name */ 33 | i = 0; 34 | argv[i++] = ((shell_module *)ipconfig)->path; 35 | 36 | /* Set NULL-terminating argument */ 37 | argv[i++] = NULL; 38 | 39 | OBJECT_TO_NPVARIANT(browser->createobject(((object *)obj)->instance, &processClass), *result); 40 | 41 | if (shell->run((process *)result->value.objectValue, ((shell_module *)ipconfig)->path, argv)) 42 | return true; 43 | else 44 | return false; 45 | } 46 | 47 | DEBUG_STR("plugin->ipconfig->invokeMethod(%s): false", DEBUG_IDENTIFIER(identifier)); 48 | return false; 49 | } 50 | 51 | bool 52 | init_module_ipconfig() 53 | { 54 | DEBUG_STR("ipconfig->init()"); 55 | ipconfig = (module *)shell->init_module("ifconfig"); 56 | ipconfig->destroy = destroy; 57 | ipconfig->class = modules->class; 58 | ipconfig->class.allocate = allocate; 59 | ipconfig->class.invoke = invokeMethod; 60 | ipconfig->class.hasProperty = hasProperty; 61 | ipconfig->class.getProperty = getProperty; 62 | ipconfig->class.setProperty = setProperty; 63 | 64 | return true; 65 | } 66 | -------------------------------------------------------------------------------- /plugin/win/ipconfig.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | #include "debug.h" 4 | #include "cmd_exe.h" 5 | #include "identifier.h" 6 | #include "init_modules.h" 7 | #include "module.h" 8 | #include "npapi.h" 9 | #include "shell.h" 10 | 11 | /* 12 | * !!! 13 | * Include common part for all systems. 14 | * !!! 15 | */ 16 | #include "../common/ipconfig.c" 17 | 18 | static bool 19 | invokeMethod(NPObject *obj, NPIdentifier identifier, const NPVariant *args, uint32_t argc, NPVariant *result) 20 | { 21 | char argv[200]; 22 | char *ptr; 23 | 24 | if (identifier == identifiers->start) { 25 | 26 | DEBUG_STR("plugin->ipconfig->invokeMethod(%s): true", DEBUG_IDENTIFIER(identifier)); 27 | 28 | /* No argument can be passed from JavaScript */ 29 | if (argc != 0) 30 | return false; 31 | 32 | ptr = argv; /* position in command string we are creating */ 33 | 34 | strcpy(ptr, "ipconfig /All "); 35 | ptr += strlen("ipconfig /All "); 36 | 37 | /* Set NULL-terminating character */ 38 | *ptr = '\0'; 39 | 40 | OBJECT_TO_NPVARIANT(browser->createobject(((object *)obj)->instance, &processClass), *result); 41 | 42 | if (cmd_line->run((process *)result->value.objectValue, argv)) 43 | return true; 44 | else 45 | return false; 46 | } 47 | 48 | DEBUG_STR("plugin->ipconfig->invokeMethod(s): false", DEBUG_IDENTIFIER(identifier)); 49 | return false; 50 | } 51 | 52 | bool 53 | init_module_ipconfig() 54 | { 55 | DEBUG_STR("ipconfig->init()"); 56 | ipconfig = (module *)shell->init_module("ipconfig"); 57 | ipconfig->destroy = destroy; 58 | ipconfig->class = modules->class; 59 | ipconfig->class.allocate = allocate; 60 | ipconfig->class.invoke = invokeMethod; 61 | ipconfig->class.hasProperty = hasProperty; 62 | ipconfig->class.getProperty = getProperty; 63 | ipconfig->class.setProperty = setProperty; 64 | 65 | return true; 66 | } 67 | -------------------------------------------------------------------------------- /plugin/debug.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #ifndef _DEBUG_H_ 3 | #define _DEBUG_H_ 4 | 5 | #include 6 | 7 | #include "config.h" 8 | #include "npapi.h" 9 | 10 | #if defined(DEBUG) 11 | 12 | #if defined(_WINDOWS) || defined(__APPLE__) || defined(ANDROID) 13 | 14 | #if defined(_WINDOWS) 15 | #define DEBUG_STDERR_FILEPATH "\\conetserv.log" 16 | #else 17 | #define DEBUG_STDERR_FILEPATH "/tmp/conetserv.log" 18 | #endif 19 | 20 | extern FILE *debug_stderr_file; 21 | 22 | /* Print debug messages to file on Windows/MacOSX/Android */ 23 | #define DEBUG_STR_PLATFORM(fmt, ...) \ 24 | do { \ 25 | debug_stderr_file = fopen(DEBUG_STDERR_FILEPATH, "a"); \ 26 | if (debug_stderr_file) { \ 27 | fprintf(debug_stderr_file, fmt, ## __VA_ARGS__); \ 28 | fclose(debug_stderr_file); \ 29 | } \ 30 | } while (0) 31 | 32 | #else 33 | 34 | /* Print debug messages to stderr on other (Unix-like) systems */ 35 | #define DEBUG_STR_PLATFORM(fmt, ...) \ 36 | fprintf(stderr, fmt, ## __VA_ARGS__) 37 | 38 | #endif 39 | 40 | /* Debug formatted string */ 41 | #define DEBUG_STR(fmt, ...) \ 42 | do { \ 43 | DEBUG_STR_PLATFORM("%s(%16s:%03d): " fmt "\n", PLUGIN_NAME, (strlen(__FILE__) > 16 ? __FILE__ + strlen(__FILE__) - 16 : __FILE__), __LINE__, ## __VA_ARGS__); \ 44 | while (debug_identifier_ptr) { \ 45 | browser->memfree(debug_identifier_str[--debug_identifier_ptr]); \ 46 | } \ 47 | } while (0) 48 | 49 | /* Debug identifier strings that should be freed immediately */ 50 | #define DEBUG_IDENTIFIER(identifier) \ 51 | (debug_identifier_str[debug_identifier_ptr++] = \ 52 | browser->utf8fromidentifier((identifier))) 53 | #define DEBUG_IDENTIFIER_COUNT 10 54 | extern NPUTF8 *debug_identifier_str[DEBUG_IDENTIFIER_COUNT]; 55 | extern int debug_identifier_ptr; 56 | 57 | #else 58 | 59 | #define DEBUG_STR(fmt, ...) 60 | #define DEBUG_IDENTIFIER(identifier) 61 | 62 | #endif 63 | 64 | #endif /*_DEBUG_H_*/ 65 | -------------------------------------------------------------------------------- /extension/about.html.in: -------------------------------------------------------------------------------- 1 |
2 |

@PROJECT_LONG@

3 |

@EXTENSION_SLOGAN@

4 |

Version: @VERSION@

5 |
6 |
7 |

Quick links:

8 |

WIKI pages at GitHub.com
9 | Source code at GitHub.com
10 | Doxygen documentation at FRES-Solutions.com
11 | JavaScript API (3rd party) at FRES-Solutions.com 12 |

13 |
14 |
15 |

Developers:

16 |

@ABOUT_AUTHORS@

17 |
18 |
19 |

Supported by:

20 |

CZ.NIC
21 | FRES-Solutions

22 |
23 |
24 |
25 |
26 |

Browser support:

27 |
    28 |
  • Mozilla Firefox 3.0+ add-on
  • 29 |
  • Google Chrome 4.0+ extension
  • 30 |
  • Opera 10.5+ widget
  • 31 |
32 |
33 |
34 |

Operating system [arch] support:

35 |
    36 |
  • Microsoft Windows [x86, x86_64]
  • 37 |
  • GNU/Linux [x86, x86_64]
  • 38 |
39 |
40 |
41 | 43 |
44 | -------------------------------------------------------------------------------- /plugin/unix/nslookup.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | #include "debug.h" 4 | #include "identifier.h" 5 | #include "init_modules.h" 6 | #include "module.h" 7 | #include "npapi.h" 8 | #include "shell.h" 9 | 10 | static bool 11 | invokeMethod(NPObject *, NPIdentifier, const NPVariant *, uint32_t, NPVariant *); 12 | 13 | /* 14 | * !!! 15 | * Include common part for all systems. 16 | * !!! 17 | */ 18 | #include "../common/nslookup.c" 19 | 20 | static bool 21 | invokeMethod(NPObject *obj, NPIdentifier identifier, const NPVariant *args, uint32_t argc, NPVariant *result) 22 | { 23 | char *argv[20]; 24 | char query[20]; 25 | int i; 26 | char *ptr; 27 | 28 | if (identifier == identifiers->start) { 29 | 30 | DEBUG_STR("plugin->nslookup->invokeMethod(%s): true", DEBUG_IDENTIFIER(identifier)); 31 | 32 | /* Just the URL argument can be passed from JavaScript */ 33 | if (argc != 1 || args[0].type != NPVariantType_String) 34 | return false; 35 | 36 | /* First argument should be command path/name */ 37 | i = 0; 38 | argv[i++] = ((shell_module *)nslookup)->path; 39 | 40 | /* Set user-defined arguments */ 41 | switch (settings.query) { 42 | case 1: 43 | if (snprintf(query, 20, "-q=AAAA")) 44 | argv[i++] = query; 45 | break; 46 | case 0: 47 | default: 48 | /* nothing .. -q=A is default for nslookup command */ 49 | break; 50 | } 51 | 52 | /* Set the URL as the last argument */ 53 | argv[i++] = (char *)STRING_UTF8CHARACTERS(args[0].value.stringValue); 54 | 55 | /* Set NULL-terminating argument */ 56 | argv[i++] = NULL; 57 | 58 | OBJECT_TO_NPVARIANT(browser->createobject(((object *)obj)->instance, &processClass), *result); 59 | 60 | if (shell->run((process *)result->value.objectValue, ((shell_module *)nslookup)->path, argv)) 61 | return true; 62 | else 63 | return false; 64 | } 65 | 66 | DEBUG_STR("plugin->nslookup->invokeMethod(%s): false", DEBUG_IDENTIFIER(identifier)); 67 | return false; 68 | } -------------------------------------------------------------------------------- /doc/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # CoNetServ documentation 2 | 3 | set(DOCUMENTATION_DIR "${CMAKE_SOURCE_DIR}/doc") 4 | 5 | set(DOXY_CONFIG "${DOCUMENTATION_DIR}/Doxyfile.in") 6 | set(DOXY_EXAMPLE_DIR "${CMAKE_SOURCE_DIR}/extension/") 7 | set(DOXY_IMAGE_FILES "${CMAKE_SOURCE_DIR}/plugin/api/") 8 | 9 | file(GLOB files1 ${CMAKE_SOURCE_DIR}/plugin/*.[ch]) 10 | file(GLOB files2 ${CMAKE_SOURCE_DIR}/plugin/api/*.h) 11 | file(GLOB files3 ${CMAKE_SOURCE_DIR}/plugin/unix/*.[ch]) 12 | file(GLOB files4 ${CMAKE_SOURCE_DIR}/plugin/win/*.[ch]) 13 | file(GLOB files5 ${CMAKE_SOURCE_DIR}/extension/js/*.js) 14 | set(files_doc ${files1} ${files2} ${files3} ${files4} ${files5} ${CMAKE_BINARY_DIR}/doc/about.h) 15 | foreach(file ${files_doc}) 16 | set(DOXY_SOURCE_FILES "${DOXY_SOURCE_FILES} ${file}") 17 | endforeach() 18 | 19 | # Find Doxygen 20 | find_package(Doxygen) 21 | 22 | if(DOXYGEN_FOUND AND DOXYGEN_EXECUTABLE AND UNIX) 23 | 24 | if(NOT EXISTS ${DOXY_CONFIG}) 25 | message(FATAL_ERROR "Doxygen config file not found" ) 26 | endif() 27 | 28 | file(MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/doc) 29 | 30 | # Copy and configure Doxyfile.in 31 | configure_file("${DOXY_CONFIG}" "${CMAKE_BINARY_DIR}/doc/Doxyfile") 32 | 33 | # Copy and configure about.h.in 34 | configure_file("${DOCUMENTATION_DIR}/about.h.in" "${CMAKE_BINARY_DIR}/doc/about.h") 35 | 36 | # Run doxygen 37 | add_custom_command( 38 | OUTPUT "${CMAKE_BINARY_DIR}/doc/html/index.html" 39 | COMMAND rm -rf ${CMAKE_BINARY_DIR}/doc/html/ 40 | COMMAND ${DOXYGEN_EXECUTABLE} "${CMAKE_BINARY_DIR}/doc/Doxyfile" 41 | DEPENDS "${CMAKE_BINARY_DIR}/doc/Doxyfile" 42 | DEPENDS "${CMAKE_BINARY_DIR}/doc/about.h" 43 | DEPENDS ${files_doc} 44 | WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/doc 45 | ) 46 | 47 | # Target to simply run `make doc' 48 | add_custom_target(doc 49 | DEPENDS "${CMAKE_BINARY_DIR}/doc/html/index.html" 50 | COMMENT "Generating Doxygen documentation." 51 | ) 52 | 53 | if(DOXYGEN_DOT_FOUND) 54 | message(STATUS "Configuring Doxygen and Graphviz Dot tool") 55 | else() 56 | message(STATUS "Configuring Doxygen") 57 | endif() 58 | 59 | else() 60 | 61 | message(STATUS "Can't configure Doxygen") 62 | 63 | endif() 64 | -------------------------------------------------------------------------------- /plugin/win/nslookup.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | #include "debug.h" 4 | #include "cmd_exe.h" 5 | #include "identifier.h" 6 | #include "init_modules.h" 7 | #include "module.h" 8 | #include "npapi.h" 9 | #include "shell.h" 10 | 11 | static bool 12 | invokeMethod(NPObject *, NPIdentifier, const NPVariant *, uint32_t, NPVariant *); 13 | 14 | /* 15 | * !!! 16 | * Include common part for all systems. 17 | * !!! 18 | */ 19 | #include "../common/nslookup.c" 20 | 21 | static bool 22 | invokeMethod(NPObject *obj, NPIdentifier identifier, const NPVariant *args, uint32_t argc, NPVariant *result) 23 | { 24 | char argv[200]; 25 | char *ptr; 26 | 27 | if (identifier == identifiers->start) { 28 | 29 | DEBUG_STR("plugin->nslookup->invokeMethod(%s): true", DEBUG_IDENTIFIER(identifier)); 30 | 31 | /* Just the URL argument can be passed from JavaScript */ 32 | if (argc != 1 || args[0].type != NPVariantType_String) 33 | return false; 34 | 35 | ptr = argv; /* position in command string we are creating */ 36 | 37 | strcpy(ptr, "nslookup "); 38 | ptr += strlen("nslookup "); 39 | 40 | /* Set user-defined arguments */ 41 | switch (settings.query) { 42 | case 1: 43 | ptr += _snprintf(ptr, 20, "-q=AAAA "); 44 | break; 45 | case 0: 46 | default: 47 | /* nothing .. -q=A is default for nslookup command */ 48 | break; 49 | } 50 | 51 | /* Set the URL as the last argument */ 52 | if (STRING_UTF8LENGTH(args[0].value.stringValue) > 100) 53 | return false; 54 | memcpy(ptr, 55 | (char *)STRING_UTF8CHARACTERS(args[0].value.stringValue), 56 | STRING_UTF8LENGTH(args[0].value.stringValue)); 57 | ptr += STRING_UTF8LENGTH(args[0].value.stringValue); 58 | 59 | /* Set NULL-terminating character */ 60 | *ptr = '\0'; 61 | 62 | OBJECT_TO_NPVARIANT(browser->createobject(((object *)obj)->instance, &processClass), *result); 63 | 64 | if (cmd_line->run((process *)result->value.objectValue, argv)) 65 | return true; 66 | else 67 | return false; 68 | } 69 | 70 | DEBUG_STR("plugin->nslookup->invokeMethod(s): false", DEBUG_IDENTIFIER(identifier)); 71 | return false; 72 | } 73 | -------------------------------------------------------------------------------- /plugin/npapi.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #ifndef _PLUGIN_NPAPI_H_ 3 | #define _PLUGIN_NPAPI_H_ 4 | 5 | #if defined(_WINDOWS) 6 | #include "stdbool.h" 7 | #define _X86_ 8 | #endif 9 | 10 | #if defined(XULRUNNER_SDK) 11 | 12 | #include 13 | #include 14 | #include 15 | 16 | #elif defined(ANDROID) 17 | 18 | #undef HAVE_LONG_LONG 19 | #include 20 | #include 21 | #include 22 | #include 23 | #define OSCALL 24 | #define NPP_WRITE_TYPE (NPP_WriteProcPtr) 25 | #define NPStringText UTF8Characters 26 | #define NPStringLen UTF8Length 27 | extern JNIEnv *pluginJniEnv; 28 | 29 | #elif defined(WEBKIT_DARWIN_SDK) 30 | 31 | #include 32 | #include 33 | #include 34 | 35 | #define OSCALL 36 | 37 | #elif defined(WEBKIT_WINMOBILE_SDK) /* WebKit SDK on Windows */ 38 | 39 | #ifndef PLATFORM 40 | #define PLATFORM(x) defined(x) 41 | #endif 42 | #include 43 | #ifndef OSCALL 44 | #define OSCALL WINAPI 45 | #endif 46 | 47 | #endif 48 | 49 | /* Return high byte of the variable */ 50 | #ifndef HIBYTE 51 | #define HIBYTE(x) ((((uint32_t)(x)) & 0xff00) >> 8) 52 | #endif 53 | 54 | /* NPAPI headers can have different struct _NPString members */ 55 | #ifdef HAVE_NPAPI_NPSTRING_CAMEL_CASE_MEMBERS 56 | #define STRING_UTF8CHARACTERS(_v) (_v).UTF8Characters 57 | #define STRING_UTF8LENGTH(_v) (_v).UTF8Length 58 | #else 59 | #define STRING_UTF8CHARACTERS(_v) (_v).utf8characters 60 | #define STRING_UTF8LENGTH(_v) (_v).utf8length 61 | #endif 62 | 63 | /*! NPAPI variables */ 64 | extern NPNetscapeFuncs *browser; 65 | 66 | /*! EXPORT functions */ 67 | #ifdef __cplusplus 68 | extern "C" { 69 | #endif 70 | 71 | NPError OSCALL NP_GetEntryPoints(NPPluginFuncs *nppfuncs); 72 | 73 | NPError OSCALL NP_Initialize(NPNetscapeFuncs *npnf 74 | #if defined(ANDROID) 75 | , NPPluginFuncs *nppfuncs, JNIEnv *env, jobject plugin_object 76 | #elif !defined(_WINDOWS) && !defined(__APPLE__) 77 | , NPPluginFuncs *nppfuncs 78 | #endif 79 | ); 80 | 81 | NPError OSCALL NP_Shutdown(); 82 | 83 | NPError OSCALL NP_GetValue(void *npp, NPPVariable variable, void *value); 84 | 85 | #ifdef __cplusplus 86 | } 87 | #endif 88 | 89 | #endif /*_PLUGIN_NPAPI_H_*/ 90 | -------------------------------------------------------------------------------- /plugin/unix/traceroute.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | #include "debug.h" 4 | #include "identifier.h" 5 | #include "init_modules.h" 6 | #include "module.h" 7 | #include "npapi.h" 8 | #include "shell.h" 9 | 10 | static bool 11 | invokeMethod(NPObject *, NPIdentifier, const NPVariant *, uint32_t, NPVariant *); 12 | 13 | /* 14 | * !!! 15 | * Include common part for all systems. 16 | * !!! 17 | */ 18 | #include "../common/traceroute.c" 19 | 20 | static bool 21 | invokeMethod(NPObject *obj, NPIdentifier identifier, const NPVariant *args, uint32_t argc, NPVariant *result) 22 | { 23 | char *argv[20]; 24 | char maxhops[20], waittime[20], iptohostname[20]; 25 | int i; 26 | char *ptr; 27 | shell_module *program; 28 | 29 | if (identifier == identifiers->start) { 30 | 31 | DEBUG_STR("plugin->tracerouteX->invokeMethod(%s): true", DEBUG_IDENTIFIER(identifier)); 32 | 33 | /* Just the URL argument can be passed from JavaScript */ 34 | if (argc != 1 || args[0].type != NPVariantType_String) 35 | return false; 36 | 37 | program = ((object_traceroute *)obj)->program; 38 | 39 | /* First argument should be command path/name */ 40 | i = 0; 41 | argv[i++] = program->path; 42 | 43 | /* Set user-defined arguments */ 44 | if (settings.maxhops > 0) { 45 | if (snprintf(maxhops, 20, "-m %d", settings.maxhops)) 46 | argv[i++] = maxhops; 47 | } 48 | if (settings.waittime > 0) { 49 | if (snprintf(waittime, 20, "-w %d", settings.waittime)) 50 | argv[i++] = waittime; 51 | } 52 | if (!settings.iptohostname) { 53 | if (snprintf(iptohostname, 20, "-n", settings.iptohostname)) 54 | argv[i++] = iptohostname; 55 | } 56 | 57 | /* Set the URL as the last argument */ 58 | argv[i++] = (char *)STRING_UTF8CHARACTERS(args[0].value.stringValue); 59 | 60 | /* Set NULL-terminating argument */ 61 | argv[i++] = NULL; 62 | 63 | OBJECT_TO_NPVARIANT(browser->createobject(((object *)obj)->instance, &processClass), *result); 64 | 65 | if (shell->run((process *)result->value.objectValue, program->path, argv)) 66 | return true; 67 | else 68 | return false; 69 | } 70 | 71 | DEBUG_STR("plugin->tracerouteX->invokeMethod(%s): false", DEBUG_IDENTIFIER(identifier)); 72 | return false; 73 | } -------------------------------------------------------------------------------- /plugin/unix/nmap.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | #include "debug.h" 4 | #include "identifier.h" 5 | #include "init_modules.h" 6 | #include "module.h" 7 | #include "npapi.h" 8 | #include "shell.h" 9 | 10 | static bool 11 | invokeMethod(NPObject *, NPIdentifier, const NPVariant *, uint32_t, NPVariant *); 12 | 13 | /* 14 | * !!! 15 | * Include common part for all systems. 16 | * !!! 17 | */ 18 | #include "../common/nmap.c" 19 | 20 | static bool 21 | invokeMethod(NPObject *obj, NPIdentifier identifier, const NPVariant *args, uint32_t argc, NPVariant *result) 22 | { 23 | char *argv[20]; 24 | char query[20]; 25 | int i; 26 | char *ptr, *tmp; 27 | 28 | if (identifier == identifiers->start) { 29 | 30 | DEBUG_STR("plugin->nmap->invokeMethod(%s): true", DEBUG_IDENTIFIER(identifier)); 31 | 32 | /* Just the URL argument can be passed from JavaScript */ 33 | if (argc != 1 || args[0].type != NPVariantType_String) 34 | return false; 35 | 36 | /* First argument should be command path/name */ 37 | i = 0; 38 | argv[i++] = ((shell_module *)nmap)->path; 39 | 40 | /* Set user-defined arguments */ 41 | switch (settings.query) { 42 | case 1: /* scan local neighboars */ 43 | if (snprintf(query, 20, "-sT")) 44 | argv[i++] = query; 45 | break; 46 | case 0: /* scan ports of a host */ 47 | default: 48 | /* nothing .. default for nmap command */ 49 | break; 50 | } 51 | 52 | /* FIXME: */ 53 | /* Test if there is ':' char -> IPv6 */ 54 | tmp = (char *)STRING_UTF8CHARACTERS(args[0].value.stringValue); 55 | while (*tmp++ != '\0') { 56 | if (*tmp == ':') { 57 | argv[i++] = "-6"; 58 | break; 59 | } 60 | } 61 | 62 | /* Set the URL as the last argument */ 63 | argv[i++] = (char *)STRING_UTF8CHARACTERS(args[0].value.stringValue); 64 | 65 | /* Set NULL-terminating argument */ 66 | argv[i++] = NULL; 67 | 68 | OBJECT_TO_NPVARIANT(browser->createobject(((object *)obj)->instance, &processClass), *result); 69 | 70 | if (shell->run((process *)result->value.objectValue, ((shell_module *)nmap)->path, argv)) 71 | return true; 72 | else 73 | return false; 74 | } 75 | 76 | DEBUG_STR("plugin->nmap->invokeMethod(%s): false", DEBUG_IDENTIFIER(identifier)); 77 | return false; 78 | } -------------------------------------------------------------------------------- /plugin/win/nmap.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | #include "debug.h" 4 | #include "cmd_exe.h" 5 | #include "identifier.h" 6 | #include "init_modules.h" 7 | #include "module.h" 8 | #include "npapi.h" 9 | #include "shell.h" 10 | 11 | static bool 12 | invokeMethod(NPObject *, NPIdentifier, const NPVariant *, uint32_t, NPVariant *); 13 | 14 | /* 15 | * !!! 16 | * Include common part for all systems. 17 | * !!! 18 | */ 19 | #include "../common/nmap.c" 20 | 21 | static bool 22 | invokeMethod(NPObject *obj, NPIdentifier identifier, const NPVariant *args, uint32_t argc, NPVariant *result) 23 | { 24 | char argv[200]; 25 | char *ptr, *tmp; 26 | 27 | if (identifier == identifiers->start) { 28 | 29 | DEBUG_STR("plugin->nmap->invokeMethod(%s): true", DEBUG_IDENTIFIER(identifier)); 30 | 31 | /* Just the URL argument can be passed from JavaScript */ 32 | if (argc != 1 || args[0].type != NPVariantType_String) 33 | return false; 34 | 35 | ptr = argv; /* position in command string we are creating */ 36 | 37 | strcpy(ptr, "nmap "); 38 | ptr += strlen("nmap "); 39 | 40 | /* Set user-defined arguments */ 41 | switch (settings.query) { 42 | case 1: /* scan local neighboars */ 43 | ptr += _snprintf(ptr, 20, "-sT "); 44 | break; 45 | case 0: /* scan ports of a host */ 46 | default: 47 | /* nothing .. default for nmap command */ 48 | break; 49 | } 50 | 51 | /* FIXME: */ 52 | /* Test if there is ':' char -> IPv6 */ 53 | tmp = (char *)STRING_UTF8CHARACTERS(args[0].value.stringValue); 54 | while (*tmp++ != '\0') { 55 | if (*tmp == ':') { 56 | ptr += _snprintf(ptr, 20, "-6 "); 57 | break; 58 | } 59 | } 60 | 61 | /* Set the URL as the last argument */ 62 | if (STRING_UTF8LENGTH(args[0].value.stringValue) > 100) 63 | return false; 64 | memcpy(ptr, 65 | (char *)STRING_UTF8CHARACTERS(args[0].value.stringValue), 66 | STRING_UTF8LENGTH(args[0].value.stringValue)); 67 | ptr += STRING_UTF8LENGTH(args[0].value.stringValue); 68 | 69 | /* Set NULL-terminating character */ 70 | *ptr = '\0'; 71 | 72 | OBJECT_TO_NPVARIANT(browser->createobject(((object *)obj)->instance, &processClass), *result); 73 | 74 | if (cmd_line->run((process *)result->value.objectValue, argv)) 75 | return true; 76 | else 77 | return false; 78 | } 79 | 80 | DEBUG_STR("plugin->nmap->invokeMethod(s): false", DEBUG_IDENTIFIER(identifier)); 81 | return false; 82 | } 83 | -------------------------------------------------------------------------------- /plugin/win/tracert.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | #include "debug.h" 4 | #include "cmd_exe.h" 5 | #include "identifier.h" 6 | #include "init_modules.h" 7 | #include "module.h" 8 | #include "npapi.h" 9 | #include "shell.h" 10 | 11 | static bool 12 | invokeMethod(NPObject *, NPIdentifier, const NPVariant *, uint32_t, NPVariant *); 13 | 14 | /* 15 | * !!! 16 | * Include common part for all systems. 17 | * !!! 18 | */ 19 | #include "../common/traceroute.c" 20 | 21 | static bool 22 | invokeMethod(NPObject *obj, NPIdentifier identifier, const NPVariant *args, uint32_t argc, NPVariant *result) 23 | { 24 | char argv[200]; 25 | char *ptr; 26 | cmd_exe_module *program; 27 | 28 | if (identifier == identifiers->start) { 29 | 30 | DEBUG_STR("plugin->tracerouteX->invokeMethod(%s): true", DEBUG_IDENTIFIER(identifier)); 31 | 32 | /* Just the URL argument can be passed from JavaScript */ 33 | if (argc != 1 || args[0].type != NPVariantType_String) 34 | return false; 35 | 36 | ptr = argv; /* position in command string we are creating */ 37 | 38 | /* Choose program (traceroute or traceroute6) */ 39 | program = ((object_traceroute *)obj)->program; 40 | if (((object_traceroute *)obj)->program == (cmd_exe_module *)traceroute6) { 41 | strcpy(ptr, "tracert -6 "); 42 | ptr += strlen("tracert -6 "); 43 | } else { 44 | strcpy(ptr, "tracert "); 45 | ptr += strlen("tracert "); 46 | } 47 | 48 | /* Set user-defined arguments */ 49 | if (settings.maxhops > 0) { 50 | ptr += _snprintf(ptr, 20, "-h %d ", settings.maxhops); 51 | } 52 | if (settings.waittime > 0) { 53 | ptr += _snprintf(ptr, 20, "-w %d ", settings.waittime); 54 | } 55 | if (!settings.iptohostname) { 56 | ptr += _snprintf(ptr, 20, "-d "); 57 | } 58 | 59 | /* Set the URL as the last argument */ 60 | if (STRING_UTF8LENGTH(args[0].value.stringValue) > 100) 61 | return false; 62 | memcpy(ptr, 63 | (char *)STRING_UTF8CHARACTERS(args[0].value.stringValue), 64 | STRING_UTF8LENGTH(args[0].value.stringValue)); 65 | ptr += STRING_UTF8LENGTH(args[0].value.stringValue); 66 | 67 | /* Set NULL-terminating character */ 68 | *ptr = '\0'; 69 | 70 | OBJECT_TO_NPVARIANT(browser->createobject(((object *)obj)->instance, &processClass), *result); 71 | 72 | if (cmd_line->run((process *)result->value.objectValue, argv)) 73 | return true; 74 | else 75 | return false; 76 | } 77 | 78 | DEBUG_STR("plugin->tracerouteX->invokeMethod(s): false", DEBUG_IDENTIFIER(identifier)); 79 | return false; 80 | } 81 | -------------------------------------------------------------------------------- /plugin/win/ping.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | #include "debug.h" 4 | #include "cmd_exe.h" 5 | #include "identifier.h" 6 | #include "init_modules.h" 7 | #include "module.h" 8 | #include "npapi.h" 9 | #include "shell.h" 10 | 11 | static bool 12 | invokeMethod(NPObject *, NPIdentifier, const NPVariant *, uint32_t, NPVariant *); 13 | 14 | /* 15 | * !!! 16 | * Include common part for all systems. 17 | * !!! 18 | */ 19 | #include "../common/ping.c" 20 | 21 | static bool 22 | invokeMethod(NPObject *obj, NPIdentifier identifier, const NPVariant *args, uint32_t argc, NPVariant *result) 23 | { 24 | char argv[200]; 25 | char *ptr; 26 | cmd_exe_module *program; 27 | 28 | if (identifier == identifiers->start) { 29 | 30 | DEBUG_STR("plugin->pingX->invokeMethod(%s): true", DEBUG_IDENTIFIER(identifier)); 31 | 32 | /* Just the URL argument can be passed from JavaScript */ 33 | if (argc != 1 || args[0].type != NPVariantType_String) 34 | return false; 35 | 36 | ptr = argv; /* position in command string we are creating */ 37 | 38 | /* Choose program (ping or ping6) */ 39 | program = ((object_ping *)obj)->program; 40 | if (((object_ping *)obj)->program == (cmd_exe_module *)ping6) { 41 | strcpy(ptr, "ping -6 "); 42 | ptr += strlen("ping -6 "); 43 | } else { 44 | strcpy(ptr, "ping "); 45 | ptr += strlen("ping "); 46 | } 47 | 48 | /* Set user-defined arguments */ 49 | if (settings.count > 0) { 50 | ptr += _snprintf(ptr, 20, "-n %d ", settings.count); 51 | } else if (settings.count == 0) { 52 | ptr += _snprintf(ptr, 20, "-t "); 53 | } 54 | if (settings.packetsize > 0) { 55 | ptr += _snprintf(ptr, 20, "-l %d ", settings.packetsize); 56 | } 57 | if (settings.timeout > 0) { 58 | ptr += _snprintf(ptr, 20, "-w %d ", settings.timeout); 59 | } 60 | if (settings.ttl > 0) { 61 | ptr += _snprintf(ptr, 20, "-i %d ", settings.ttl); 62 | } 63 | 64 | /* Set the URL as the last argument */ 65 | if (STRING_UTF8LENGTH(args[0].value.stringValue) > 100) 66 | return false; 67 | memcpy(ptr, 68 | (char *)STRING_UTF8CHARACTERS(args[0].value.stringValue), 69 | STRING_UTF8LENGTH(args[0].value.stringValue)); 70 | ptr += STRING_UTF8LENGTH(args[0].value.stringValue); 71 | 72 | /* Set NULL-terminating character */ 73 | *ptr = '\0'; 74 | 75 | OBJECT_TO_NPVARIANT(browser->createobject(((object *)obj)->instance, &processClass), *result); 76 | 77 | if (cmd_line->run((process *)result->value.objectValue, argv)) 78 | return true; 79 | else 80 | return false; 81 | } 82 | 83 | DEBUG_STR("plugin->pingX->invokeMethod(s): false", DEBUG_IDENTIFIER(identifier)); 84 | return false; 85 | } 86 | -------------------------------------------------------------------------------- /plugin/unix/ping.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | #include "debug.h" 4 | #include "identifier.h" 5 | #include "init_modules.h" 6 | #include "module.h" 7 | #include "npapi.h" 8 | #include "shell.h" 9 | 10 | static bool 11 | invokeMethod(NPObject *, NPIdentifier, const NPVariant *, uint32_t, NPVariant *); 12 | 13 | /* 14 | * !!! 15 | * Include common part for all systems. 16 | * !!! 17 | */ 18 | #include "../common/ping.c" 19 | 20 | static bool 21 | invokeMethod(NPObject *obj, NPIdentifier identifier, const NPVariant *args, uint32_t argc, NPVariant *result) 22 | { 23 | char *argv[20]; 24 | char count[20], timeout[20], packetsize[20], ttl[20]; 25 | int i; 26 | char *ptr; 27 | shell_module *program; 28 | 29 | if (identifier == identifiers->start) { 30 | 31 | DEBUG_STR("plugin->pingX->invokeMethod(%s): true", DEBUG_IDENTIFIER(identifier)); 32 | 33 | /* Just the URL argument can be passed from JavaScript */ 34 | if (argc != 1 || args[0].type != NPVariantType_String) 35 | return false; 36 | 37 | program = ((object_ping *)obj)->program; 38 | 39 | /* First argument should be command path/name */ 40 | i = 0; 41 | argv[i++] = program->path; 42 | 43 | /* Set default arguments */ 44 | argv[i++] = "-n"; /* Numeric output only */ 45 | #if !defined(__APPLE__) /* Must be super-user on MacOSX */ 46 | argv[i++] = "-l3"; /* Preload - Send 3 packets without waiting for reply */ 47 | #endif 48 | 49 | /* Set user-defined arguments */ 50 | if (settings.count > 0) { 51 | if (snprintf(count, 20, "-c %d", settings.count)) 52 | argv[i++] = count; 53 | } 54 | if (settings.packetsize > 0) { 55 | if (snprintf(packetsize, 20, "-s %d", settings.packetsize)) 56 | argv[i++] = packetsize; 57 | } 58 | #if !defined(__APPLE__) 59 | if (settings.timeout > 0) { 60 | if (snprintf(timeout, 20, "-W %d", settings.timeout)) 61 | argv[i++] = timeout; 62 | } 63 | #endif 64 | if (settings.ttl > 0) { 65 | #if defined(__APPLE__) 66 | if (snprintf(ttl, 20, "-m %d", settings.ttl)) 67 | argv[i++] = ttl; 68 | #else 69 | if (snprintf(ttl, 20, "-t %d", settings.ttl)) 70 | argv[i++] = ttl; 71 | #endif 72 | } 73 | 74 | /* Set the URL as the last argument */ 75 | argv[i++] = (char *)STRING_UTF8CHARACTERS(args[0].value.stringValue); 76 | 77 | /* Set NULL-terminating argument */ 78 | argv[i++] = NULL; 79 | 80 | OBJECT_TO_NPVARIANT(browser->createobject(((object *)obj)->instance, &processClass), *result); 81 | 82 | if (shell->run((process *)result->value.objectValue, program->path, argv)) 83 | return true; 84 | else 85 | return false; 86 | } 87 | 88 | DEBUG_STR("plugin->pingX->invokeMethod(%s): false", DEBUG_IDENTIFIER(identifier)); 89 | return false; 90 | } 91 | -------------------------------------------------------------------------------- /plugin/common/nmap.c: -------------------------------------------------------------------------------- 1 | /* NMAP module */ 2 | module *nmap = NULL; 3 | 4 | /** 5 | * Object NMAP 6 | * Used to distinguish NMAP object passed from JavaScript 7 | */ 8 | typedef struct _object_nmap { 9 | object obj; 10 | } object_nmap; 11 | 12 | /** 13 | * NMAP settings 14 | */ 15 | static struct { 16 | int query; 17 | } settings = {0}; 18 | 19 | static bool 20 | hasProperty(NPObject *obj, NPIdentifier identifier) 21 | { 22 | if (identifier == identifiers->found) { 23 | DEBUG_STR("plugin->nmap->hasProperty(%s): true", DEBUG_IDENTIFIER(identifier)); 24 | return true; 25 | } 26 | if (identifier == identifiers->query) { 27 | DEBUG_STR("plugin->ping->hasProperty(%s): true", DEBUG_IDENTIFIER(identifier)); 28 | return true; 29 | } 30 | DEBUG_STR("plugin->nmap->hasProperty(%s): false", DEBUG_IDENTIFIER(identifier)); 31 | return false; 32 | } 33 | 34 | static bool 35 | getProperty(NPObject *obj, NPIdentifier identifier, NPVariant *value) 36 | { 37 | if (identifier == identifiers->found) { 38 | DEBUG_STR("plugin->nmap->getProperty(%s): true", DEBUG_IDENTIFIER(identifier)); 39 | BOOLEAN_TO_NPVARIANT(((shell_module *)nmap)->found, *value); 40 | return true; 41 | } 42 | if (identifier == identifiers->query) { 43 | DEBUG_STR("plugin->ping->hasProperty(%s): true", DEBUG_IDENTIFIER(identifier)); 44 | INT32_TO_NPVARIANT(settings.query, *value); 45 | return true; 46 | } 47 | DEBUG_STR("plugin->nmap->getProperty(%s): false", DEBUG_IDENTIFIER(identifier)); 48 | return false; 49 | } 50 | 51 | static bool 52 | setProperty(NPObject *obj, NPIdentifier identifier, const NPVariant *value) 53 | { 54 | if (identifier == identifiers->query) { 55 | DEBUG_STR("plugin->ping->hasProperty(%s): true", DEBUG_IDENTIFIER(identifier)); 56 | settings.query = NPVARIANT_TO_INT32(*value); 57 | return true; 58 | } 59 | DEBUG_STR("plugin->nmap->setProperty(%s): false", DEBUG_IDENTIFIER(identifier)); 60 | return false; 61 | } 62 | 63 | static void 64 | destroy() 65 | { 66 | DEBUG_STR("nmap->destroy()"); 67 | if (nmap) 68 | shell->destroy_module((shell_module *)nmap); 69 | } 70 | 71 | static NPObject * 72 | allocate(NPP instance, NPClass *class) 73 | { 74 | object_nmap *obj; 75 | 76 | DEBUG_STR("plugin->nmap->allocate()"); 77 | 78 | obj = browser->memalloc(sizeof(*obj)); 79 | ((object *)obj)->instance = instance; 80 | 81 | return (NPObject *)obj; 82 | } 83 | 84 | bool 85 | init_module_nmap() 86 | { 87 | DEBUG_STR("nmap->init()"); 88 | nmap = (module *)shell->init_module("nmap"); 89 | nmap->destroy = destroy; 90 | nmap->class = modules->class; 91 | nmap->class.allocate = allocate; 92 | nmap->class.invoke = invokeMethod; 93 | nmap->class.hasProperty = hasProperty; 94 | nmap->class.getProperty = getProperty; 95 | nmap->class.setProperty = setProperty; 96 | 97 | return true; 98 | } 99 | -------------------------------------------------------------------------------- /plugin/identifier.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | #include "debug.h" 4 | #include "npapi.h" 5 | #include "identifier.h" 6 | 7 | identifier *identifiers = NULL; 8 | 9 | void 10 | destroy() 11 | { 12 | DEBUG_STR("identifiers->destroy()"); 13 | browser->memfree(identifiers); 14 | } 15 | 16 | bool 17 | init_identifiers() 18 | { 19 | DEBUG_STR("identifiers->init()"); 20 | 21 | if ((identifiers = browser->memalloc(sizeof(*identifiers))) == NULL) 22 | return false; 23 | 24 | identifiers->read = browser->getstringidentifier("read"); 25 | identifiers->running = browser->getstringidentifier("running"); 26 | identifiers->start = browser->getstringidentifier("start"); 27 | identifiers->stop = browser->getstringidentifier("stop"); 28 | identifiers->version = browser->getstringidentifier("version"); 29 | identifiers->found = browser->getstringidentifier("found"); 30 | 31 | #ifdef MODULE_PING 32 | identifiers->ping = browser->getstringidentifier("ping"); 33 | #endif 34 | 35 | #ifdef MODULE_PING6 36 | identifiers->ping6 = browser->getstringidentifier("ping6"); 37 | #endif 38 | 39 | #if defined(MODULE_PING) || defined(MODULE_PING6) 40 | identifiers->count = browser->getstringidentifier("count"); 41 | identifiers->timeout = browser->getstringidentifier("timeout"); 42 | identifiers->packetsize = browser->getstringidentifier("packetsize"); 43 | identifiers->ttl = browser->getstringidentifier("ttl"); 44 | #endif 45 | 46 | #ifdef MODULE_TRACEROUTE 47 | identifiers->tracert = browser->getstringidentifier("tracert"); 48 | identifiers->traceroute = browser->getstringidentifier("traceroute"); 49 | #endif 50 | 51 | #ifdef MODULE_TRACEROUTE6 52 | identifiers->tracert6 = browser->getstringidentifier("tracert6"); 53 | identifiers->traceroute6 = browser->getstringidentifier("traceroute6"); 54 | #endif 55 | 56 | #if defined(MODULE_TRACEROUTE) || defined(MODULE_TRACEROUTE6) 57 | identifiers->maxhops = browser->getstringidentifier("maxhops"); 58 | identifiers->waittime = browser->getstringidentifier("waittime"); 59 | identifiers->iptohostname = browser->getstringidentifier("iptohostname"); 60 | #endif 61 | 62 | #ifdef MODULE_NSLOOKUP 63 | identifiers->nslookup = browser->getstringidentifier("nslookup"); 64 | #endif 65 | 66 | #if defined(MODULE_NSLOOKUP) || defined(MODULE_NMAP) 67 | identifiers->query = browser->getstringidentifier("query"); 68 | #endif 69 | 70 | #ifdef MODULE_WHOIS 71 | identifiers->whois = browser->getstringidentifier("whois"); 72 | #endif 73 | 74 | #ifdef MODULE_DIG 75 | identifiers->dig = browser->getstringidentifier("dig"); 76 | #endif 77 | 78 | #ifdef MODULE_NMAP 79 | identifiers->nmap = browser->getstringidentifier("nmap"); 80 | #endif 81 | 82 | #ifdef MODULE_IPCONFIG 83 | identifiers->ipconfig = browser->getstringidentifier("ipconfig"); 84 | identifiers->ifconfig = browser->getstringidentifier("ifconfig"); 85 | #endif 86 | 87 | identifiers->destroy = destroy; 88 | 89 | return true; 90 | } -------------------------------------------------------------------------------- /plugin/common/nslookup.c: -------------------------------------------------------------------------------- 1 | /* NSLOOKUP module */ 2 | module *nslookup = NULL; 3 | 4 | /** 5 | * Object NSLOOKUP 6 | * Used to distinguish NSLOOKUP object passed from JavaScript 7 | */ 8 | typedef struct _object_nslookup { 9 | object obj; 10 | } object_nslookup; 11 | 12 | /** 13 | * NSLOOKUP settings 14 | */ 15 | static struct { 16 | int query; 17 | } settings = {0}; 18 | 19 | static bool 20 | hasProperty(NPObject *obj, NPIdentifier identifier) 21 | { 22 | if (identifier == identifiers->found) { 23 | DEBUG_STR("plugin->nslookup->hasProperty(%s): true", DEBUG_IDENTIFIER(identifier)); 24 | return true; 25 | } 26 | if (identifier == identifiers->query) { 27 | DEBUG_STR("plugin->ping->hasProperty(%s): true", DEBUG_IDENTIFIER(identifier)); 28 | return true; 29 | } 30 | DEBUG_STR("plugin->nslookup->hasProperty(%s): false", DEBUG_IDENTIFIER(identifier)); 31 | return false; 32 | } 33 | 34 | static bool 35 | getProperty(NPObject *obj, NPIdentifier identifier, NPVariant *value) 36 | { 37 | if (identifier == identifiers->found) { 38 | DEBUG_STR("plugin->nslookup->getProperty(%s): true", DEBUG_IDENTIFIER(identifier)); 39 | BOOLEAN_TO_NPVARIANT(((shell_module *)nslookup)->found, *value); 40 | return true; 41 | } 42 | if (identifier == identifiers->query) { 43 | DEBUG_STR("plugin->ping->hasProperty(%s): true", DEBUG_IDENTIFIER(identifier)); 44 | INT32_TO_NPVARIANT(settings.query, *value); 45 | return true; 46 | } 47 | DEBUG_STR("plugin->nslookup->getProperty(%s): false", DEBUG_IDENTIFIER(identifier)); 48 | return false; 49 | } 50 | 51 | static bool 52 | setProperty(NPObject *obj, NPIdentifier identifier, const NPVariant *value) 53 | { 54 | if (identifier == identifiers->query) { 55 | DEBUG_STR("plugin->ping->hasProperty(%s): true", DEBUG_IDENTIFIER(identifier)); 56 | settings.query = NPVARIANT_TO_INT32(*value); 57 | return true; 58 | } 59 | DEBUG_STR("plugin->nslookup->setProperty(%s): false", DEBUG_IDENTIFIER(identifier)); 60 | return false; 61 | } 62 | 63 | static void 64 | destroy() 65 | { 66 | DEBUG_STR("nslookup->destroy()"); 67 | if (nslookup) 68 | shell->destroy_module((shell_module *)nslookup); 69 | } 70 | 71 | static NPObject * 72 | allocate(NPP instance, NPClass *class) 73 | { 74 | object_nslookup *obj; 75 | 76 | DEBUG_STR("plugin->nslookup->allocate()"); 77 | 78 | obj = browser->memalloc(sizeof(*obj)); 79 | ((object *)obj)->instance = instance; 80 | 81 | return (NPObject *)obj; 82 | } 83 | 84 | bool 85 | init_module_nslookup() 86 | { 87 | DEBUG_STR("nslookup->init()"); 88 | nslookup = (module *)shell->init_module("nslookup"); 89 | nslookup->destroy = destroy; 90 | nslookup->class = modules->class; 91 | nslookup->class.allocate = allocate; 92 | nslookup->class.invoke = invokeMethod; 93 | nslookup->class.hasProperty = hasProperty; 94 | nslookup->class.getProperty = getProperty; 95 | nslookup->class.setProperty = setProperty; 96 | 97 | return true; 98 | } 99 | -------------------------------------------------------------------------------- /extension/js/jquery/jquery.flot.valuelabels.js: -------------------------------------------------------------------------------- 1 | /* Value Labels Plugin for flot. 2 | * Homepage: 3 | * http://sites.google.com/site/petrsstuff/projects/flotvallab 4 | * 5 | * Released under the MIT license by Petr Blahos, December 2009. 6 | * 7 | */ 8 | (function ($) { 9 | var options = { 10 | valueLabels: { 11 | show: false 12 | } 13 | }; 14 | 15 | function init(plot) { 16 | plot.hooks.draw.push(function (plot, ctx) { 17 | if (!plot.getOptions().valueLabels.show) { 18 | return 19 | } 20 | $.each(plot.getData(), function(ii, series) { 21 | plot.getPlaceholder().find("#valueLabels"+ii).remove(); 22 | var html = '
'; 23 | var last_val = null; 24 | var last_x = -1000; 25 | var last_y = -1000; 26 | for (var i = 0; i < series.data.length; ++i) { 27 | if (series.data[i] == null) 28 | continue; 29 | 30 | var x = series.data[i][0], y = series.data[i][1]; 31 | if (x < series.xaxis.min || x > series.xaxis.max || y < series.yaxis.min || y > series.yaxis.max) 32 | continue; 33 | var val = y; 34 | if (series.valueLabelFunc) { 35 | val = series.valueLabelFunc({ 36 | series: series, 37 | seriesIndex: ii, 38 | index: i 39 | }); 40 | } 41 | val = ""+val; 42 | if (val!=last_val || i==series.data.length-1) { 43 | var xx = series.xaxis.p2c(x)+plot.getPlotOffset().left; 44 | var yy = series.yaxis.p2c(y)-12+plot.getPlotOffset().top; 45 | if (Math.abs(yy-last_y)>20 || last_x'; 56 | else 57 | tail = '">' + Conetserv.Plot.localTrace6Data.labels[i] + '
'; 58 | html+= head + "Light" + tail + head + tail; 59 | } 60 | } 61 | } 62 | html+= ""; 63 | plot.getPlaceholder().append(html); 64 | }); 65 | }); 66 | } 67 | 68 | $.plot.plugins.push({ 69 | init: init, 70 | options: options, 71 | name: 'valueLabels', 72 | version: '1.0' 73 | }); 74 | })(jQuery); 75 | 76 | -------------------------------------------------------------------------------- /extension/js/conetserv.js: -------------------------------------------------------------------------------- 1 | /* Check CoNetServ object */ 2 | if(!Conetserv) var Conetserv = {}; 3 | 4 | Conetserv.plugin = false; 5 | Conetserv.version = "2.1.0"; 6 | Conetserv.changelog = "* Object-oriented API to JS (availability for 3rd party)
\ 7 | * Independent objects to run programs and commands with options
\ 8 | * User-friendly error messages
\ 9 | * Installation guides for missing programs (OS, platform, distro)" 10 | 11 | Conetserv.onReady = function() { 12 | 13 | /* Toggle tabs with opacity effect */ 14 | //too slow and thus buggy; disable temporarily 15 | //$("#tabs").tabs({ fx: { opacity: 'toggle' } }); 16 | 17 | $('#plugin-placeholder').append(''); 18 | 19 | /* Inicialize conetserv plugin */ 20 | this.plugin = document.getElementById("conetserv"); 21 | 22 | /* init Conetserv.Url in Firefox */ 23 | if ($.client.browser == "Firefox") { 24 | if (window && window.arguments && window.arguments[0] && Conetserv.Url.set(window.arguments[0])) { 25 | if(Conetserv.LocalServices.enabled) { 26 | document.getElementById("local-url").value = Conetserv.Url.hostname; 27 | } 28 | if(Conetserv.ExternalServices.enabled) { 29 | document.getElementById("external-url").value = Conetserv.Url.hostname; 30 | } 31 | } 32 | /* init url in Chrome */ 33 | } else if ($.client.browser == "Chrome") { 34 | if (chrome && chrome.tabs && chrome.tabs.getSelected) { 35 | chrome.tabs.getSelected(null, function(tab) { 36 | Conetserv.Url.set(tab.url); 37 | if(Conetserv.LocalServices.enabled) { 38 | document.getElementById("local-url").value = Conetserv.Url.hostname; 39 | } 40 | if(Conetserv.ExternalServices.enabled) { 41 | 42 | document.getElementById("external-url").value = Conetserv.Url.hostname; 43 | } 44 | }); 45 | } 46 | } 47 | /* 48 | * Initialize ui 49 | */ 50 | this.Ui.checkAvailability(); 51 | this.Ui.redraw(); 52 | 53 | Conetserv.LocalServices.initialize(); 54 | Conetserv.ExternalServices.initialize(); 55 | Conetserv.LocalInfo.initialize(); 56 | 57 | Conetserv.Options.initialize(); 58 | 59 | Conetserv.Plot.initialize(); 60 | }; 61 | 62 | Conetserv.onLoad = function() { 63 | /* 64 | * Check autostart - on true start services 65 | */ 66 | if(this.Options.autostart()) { 67 | /* 68 | * Start services on main page 69 | */ 70 | if(this.Options.frontPageParent() == "local-services") { 71 | setTimeout("Conetserv.LocalServices.startCommands()", 250); 72 | } 73 | else if(this.Options.frontPageParent() == "external-services") { 74 | setTimeout("Conetserv.ExternalServices.start()", 250); 75 | } 76 | } 77 | if(this.Options.frontPageParent() == "external-info") { 78 | setTimeout("Conetserv.ExternalInfo.start()", 250); 79 | } 80 | if(this.Options.frontPageParent() == "local-info") { 81 | setTimeout("Conetserv.LocalInfo.start()", 250) 82 | } 83 | } 84 | -------------------------------------------------------------------------------- /extension/js/externalinfo.js: -------------------------------------------------------------------------------- 1 | /* Check CoNetServ object */ 2 | if(!Conetserv) var Conetserv = {}; 3 | 4 | /* External info object */ 5 | Conetserv.ExternalInfo = { 6 | isRunning : 0, 7 | 8 | start : function () { 9 | if(this.isRunning) 10 | return; 11 | this.isRunning = 1; 12 | 13 | Conetserv.Map.setElementId("map-placeholder"); 14 | 15 | /* Start external info services */ 16 | Conetserv.Services.start( 17 | /* started */ 18 | function() { 19 | Conetserv.Ui.addIcons(".external", ".provider", ""); 20 | }, 21 | /* service results */ 22 | function(service, result) { 23 | var source = ' (' + service.name + ')'; 24 | if (result.externIpv4) 25 | $("#externIpv4").append('
  • ' + result.externIpv4 + ' ' + source + '
  • '); 26 | if (result.externIpv6) 27 | $("#externIpv6").append('
  • ' + result.externIpv6 + ' ' + source + '
  • '); 28 | if (result.provider) 29 | $("#provider").append('
  • ' + result.provider + ' ' + source + '
  • '); 30 | if (result.hostname) 31 | $("#hostname").append('
  • ' + result.hostname + ' ' + source + '
  • '); 32 | if (result.route) 33 | $("#route").append('
  • ' + result.route + ' ' + source + '
  • '); 34 | if (result.city || result.region || result.country || 35 | result.countryCode || result.longitude || result.latitude) { 36 | $("#location").append( 37 | '
  • ' + 38 | (result.city ? result.city + ', ' : '') + 39 | (result.region ? result.region + ', ' : '') + 40 | (result.country ? result.country : '') + 41 | (result.countryCode ? ' [' + result.countryCode + ']' : '') + 42 | ' ' + 43 | (result.longitude ? 'Longitude: ' + result.longitude : '') + 44 | (result.latitude ? ', Latitude: ' + result.latitude : '') + 45 | source + '
  • ' 46 | ); 47 | 48 | // show map location 49 | if(result.longitude && result.latitude) { 50 | /* set element to write map into */ 51 | Conetserv.Map.addLocation(service, result); 52 | //check, if page is defaultly shown, otherwise show on buttonclick 53 | if($("#external-info input[type=radio]:checked").val() == "external-map-div") { 54 | Conetserv.Map.show(); 55 | } else { 56 | $("#external-map").click(function(){ 57 | Conetserv.Map.show(); 58 | }); 59 | } 60 | } 61 | } 62 | }, 63 | /* stopped */ 64 | function() { 65 | Conetserv.Ui.removeIcons(".external", ".provider"); 66 | } 67 | ); 68 | } 69 | } -------------------------------------------------------------------------------- /CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # CoNetServ (Complex Network Services) project 2 | project("CoNetServ") 3 | set(MAJOR_VERSION 2) 4 | set(MINOR_VERSION 1) 5 | set(PATCH_VERSION 0) 6 | 7 | # CMake 8 | cmake_minimum_required(VERSION 2.6 FATAL_ERROR) 9 | set(CMAKE_COLOR_MAKEFILE ON) 10 | set(CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/CMakePlugins) 11 | 12 | # Release extension packages and/or plugins are built in first level build directory 13 | # This means, that developer should build project in second level build directory, 14 | # eg. build/Linux or build/Windows. 15 | # The final packages (which contains of more platform builds) are made in the first 16 | # level build directory, eg. build/. 17 | get_filename_component(RELEASE_DIR ${CMAKE_BINARY_DIR}/../ ABSOLUTE) 18 | get_filename_component(CMAKE_SOURCE_DIR_TEST ${CMAKE_BINARY_DIR}/../../ ABSOLUTE) 19 | if(NOT "${CMAKE_SOURCE_DIR_TEST}" STREQUAL "${CMAKE_SOURCE_DIR}") 20 | message(FATAL_ERROR "Please, build project in sub-subdirectory of your source code, eg. build/${CMAKE_SYSTEM_NAME}.") 21 | endif() 22 | 23 | # Debug extensions are built in directory extension (for simple development process) 24 | get_filename_component(DEBUG_DIR ${CMAKE_SOURCE_DIR}/extension/ ABSOLUTE) 25 | 26 | # Build type 27 | # -DCMAKE_BUILD_TYPE=Release 28 | if("${CMAKE_BUILD_TYPE}" STREQUAL "Release") 29 | # Release build 30 | message(STATUS "Build type: Release") 31 | add_definitions(-DNDEBUG) 32 | set(VERSION ${MAJOR_VERSION}.${MINOR_VERSION}.${PATCH_VERSION}) 33 | else() 34 | # Debug build 35 | message(STATUS "Build type: Debug") 36 | add_definitions(-DDEBUG) 37 | set(PATCH_VERSION 99) 38 | endif() 39 | 40 | # Project strings 41 | set(VERSION ${MAJOR_VERSION}.${MINOR_VERSION}.${PATCH_VERSION}) 42 | set(PROJECT_NAME ${CMAKE_PROJECT_NAME}) 43 | string(TOLOWER ${PROJECT_NAME} PROJECT_LOW) 44 | set(PROJECT_LONG "CoNetServ (Complex Network Services)") 45 | set(PROJECT_COMPANY "FRES-Solutions") 46 | set(PROJECT_COPY "(c) 2010 ${PROJECT_COMPANY}") 47 | set(PROJECT_HOSTNAME "fres-solutions") 48 | set(PROJECT_HOST_TLD "com") 49 | set(PROJECT_HOST "${PROJECT_HOSTNAME}.${PROJECT_HOST_TLD}") 50 | set(PROJECT_URL "http://www.${PROJECT_HOSTNAME}.${PROJECT_HOST_TLD}/${PROJECT_NAME}") 51 | 52 | # Exension strings 53 | set(EXTENSION_SLOGAN "Extension that integrates network tools into the browser.") 54 | set(EXTENSION_DESC "${EXTENSION_SLOGAN} ${PROJECT_COPY}") 55 | set(EXTENSION_ID "${PROJECT_LOW}@${PROJECT_HOSTNAME}.${PROJECT_HOST_TLD}") 56 | 57 | # Plugin strings 58 | set(PLUGIN_SLOGAN "Plugin that integrates network tools into the browser.") 59 | set(PLUGIN_NAME ${PROJECT_NAME}) 60 | set(PLUGIN_LONG ${PROJECT_LONG}) 61 | set(PLUGIN_TYPE "application/x-${PROJECT_LOW}") 62 | set(PLUGIN_DESC "${PROJECT_LONG} v${VERSION}. ${PLUGIN_SLOGAN} ${PROJECT_COPY}") 63 | set(PLUGIN_ID "${PROJECT_HOST_TLD}.${PROJECT_HOSTNAME}.${PROJECT_LOW}") 64 | 65 | # Contributors 66 | if(WIN32) 67 | set(cat_prog type) 68 | else() 69 | set(cat_prog cat) 70 | endif() 71 | FILE(TO_NATIVE_PATH ${CMAKE_SOURCE_DIR}/AUTHORS.txt AUTHORS_FILE) 72 | execute_process( 73 | COMMAND ${cat_prog} ${AUTHORS_FILE} 74 | WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} 75 | OUTPUT_VARIABLE AUTHORS 76 | ) 77 | string(REGEX MATCHALL "[^\n]+" AUTHORS "${AUTHORS}") 78 | 79 | # Plugin 80 | add_subdirectory(plugin) 81 | 82 | # Extension 83 | add_subdirectory(extension) 84 | 85 | # Documentation 86 | add_subdirectory(doc) 87 | -------------------------------------------------------------------------------- /extension/js/jquery/jquery.client.js: -------------------------------------------------------------------------------- 1 | (function() { 2 | 3 | var BrowserDetect = { 4 | init: function () { 5 | this.browser = this.searchString(this.dataBrowser) || "An unknown browser"; 6 | this.version = this.searchVersion(navigator.userAgent) 7 | || this.searchVersion(navigator.appVersion) 8 | || "an unknown version"; 9 | this.OS = this.searchString(this.dataOS) || "an unknown OS"; 10 | }, 11 | searchString: function (data) { 12 | for (var i=0;i" + name + "
    " + 73 | "(Latitude: " + latitude + ", Longitude: " + longitude + ")"); 74 | }); 75 | 76 | return marker; 77 | }, 78 | 79 | show: function() { 80 | /* Set new location(s) from buffer */ 81 | if (this.loaded != true) { 82 | this.loadJsapi(); 83 | return; 84 | } 85 | 86 | var location; 87 | while (location = this.locations.shift()) { 88 | var latlng = new google.maps.LatLng(location.latitude, location.longitude); 89 | if (location.zoom > this.zoom) { 90 | this.zoom = location.zoom; 91 | this.map.setCenter(latlng, location.zoom); 92 | } 93 | this.map.addOverlay(this.createMarker(latlng, location.name, location.latitude, location.longitude)); 94 | } 95 | } 96 | }; -------------------------------------------------------------------------------- /plugin/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # CoNetServ plugin 2 | 3 | # Sources and header files 4 | include_directories(${CMAKE_BINARY_DIR}) 5 | include_directories(${CMAKE_CURRENT_SOURCE_DIR}) 6 | 7 | set(sources 8 | debug.c 9 | identifier.c 10 | npapi.c 11 | plugin.c 12 | module.c 13 | process.c 14 | ) 15 | 16 | set(headers 17 | ${CMAKE_BINARY_DIR}/config.h 18 | debug.h 19 | identifier.h 20 | npapi.h 21 | plugin.h 22 | module.h 23 | ) 24 | 25 | # Platform-specific sources and header files 26 | if(UNIX) 27 | include(unix/CMakeLists.txt) 28 | if(APPLE) 29 | include(apple/CMakeLists.txt) 30 | endif() 31 | elseif(WIN32) 32 | include(win/CMakeLists.txt) 33 | else() 34 | message(FATAL_ERROR "Sorry, your operating system is not supported.") 35 | endif() 36 | 37 | # Check NPAPI NPString members 38 | include(${CMAKE_MODULE_PATH}/NPAPI_NPString_members.cmake) 39 | 40 | # Configure header file 41 | configure_file(config.h.in ${CMAKE_BINARY_DIR}/config.h) 42 | 43 | # Create shared library 44 | add_library(CoNetServ SHARED ${sources} ${headers}) 45 | set_target_properties(CoNetServ PROPERTIES CLEAN_DIRECT_OUTPUT 1) 46 | set_target_properties(CoNetServ PROPERTIES PREFIX "np") 47 | set_target_properties(CoNetServ PROPERTIES VERSION ${VERSION}) 48 | set_target_properties(CoNetServ PROPERTIES SOVERSION ${MAJOR_VERSION}) 49 | 50 | # Copy shared library to debug/release directory 51 | get_target_property(CoNetServLibFile CoNetServ LOCATION) 52 | get_filename_component(CoNetServLibFileName ${CoNetServLibFile} NAME) 53 | 54 | include(${CMAKE_MODULE_PATH}/MozillaTargetPlatform.cmake) 55 | 56 | # Export release shared library (force simple packaging) 57 | if("${CMAKE_BUILD_TYPE}" STREQUAL "Release") 58 | 59 | set(RELEASE_PACK ${RELEASE_DIR}/${PROJECT_NAME}-${VERSION}-plugins.zip) 60 | 61 | # Create Mozilla-like platform path in release directory 62 | file(MAKE_DIRECTORY ${RELEASE_DIR}/${MOZILLA_PATH}/) 63 | 64 | add_custom_command( 65 | OUTPUT ${RELEASE_DIR}/${MOZILLA_PATH}/${PLATFORM_PATH}${CoNetServLibFileName} 66 | COMMAND ${CMAKE_COMMAND} -E copy 67 | ${CoNetServLibFile} ${RELEASE_DIR}/${MOZILLA_PATH}/${PLATFORM_PATH}${CoNetServLibFileName} 68 | DEPENDS ${CoNetServLibFile} 69 | COMMENT "Copying release shared library into: ${RELEASE_DIR}/${MOZILLA_PATH}/${PLATFORM_PATH}${CoNetServLibFileName}" 70 | ) 71 | add_custom_command( 72 | OUTPUT ${RELEASE_PACK} 73 | WORKING_DIRECTORY ${RELEASE_DIR}/platform 74 | COMMAND zip -q -r ${RELEASE_PACK} * 75 | DEPENDS ${RELEASE_DIR}/${MOZILLA_PATH}/${PLATFORM_PATH}${CoNetServLibFileName} 76 | COMMENT "Packing release plugin binaries into: ${RELEASE_PACK}" 77 | ) 78 | add_custom_target(PluginReleasePack ALL 79 | DEPENDS ${RELEASE_DIR}/${MOZILLA_PATH}/${PLATFORM_PATH}${CoNetServLibFileName} ${RELEASE_PACK} 80 | ) 81 | 82 | else() 83 | 84 | # Create Mozilla-like platform path in debug directory 85 | file(MAKE_DIRECTORY ${DEBUG_DIR}/${MOZILLA_PATH}/) 86 | 87 | add_custom_command( 88 | OUTPUT ${DEBUG_DIR}/${MOZILLA_PATH}/${PLATFORM_PATH}${CoNetServLibFileName} 89 | COMMAND ${CMAKE_COMMAND} -E copy 90 | ${CoNetServLibFile} ${DEBUG_DIR}/${MOZILLA_PATH}/${PLATFORM_PATH}${CoNetServLibFileName} 91 | DEPENDS ${CoNetServLibFile} 92 | COMMENT "Copying debug shared library into: ${DEBUG_DIR}/${MOZILLA_PATH}/${PLATFORM_PATH}${CoNetServLibFileName}" 93 | ) 94 | 95 | add_custom_target(PluginCopy ALL 96 | DEPENDS ${DEBUG_DIR}/${MOZILLA_PATH}/${PLATFORM_PATH}${CoNetServLibFileName} 97 | ) 98 | 99 | endif() 100 | -------------------------------------------------------------------------------- /README.rst: -------------------------------------------------------------------------------- 1 | CoNetServ (Complex Network Services) 2 | ==================================== 3 | **Extension that integrates network tools into the browser.** 4 | 5 | 6 | Quick links 7 | ----------- 8 | 9 | * `Wiki pages `_ 10 | * `Product overview `_ and `screenshots `_ 11 | * `Report bug `_ or `send us idea `_ (alternativelly `conetserv@fres-solutions.com `_) 12 | * `Contribute `_ (suggested donation: $3.00) 13 | * Current `TODO list `_ and `future plans `_ 14 | * Current `CHANGELOG `_ 15 | * List of `AUTHORS `_ 16 | 17 | .. image:: http://github.com/V-Teq/CoNetServ/raw/master/extension/images/icon128.png 18 | 19 | Directory structure 20 | ------------------- 21 | ==================== ======================================= 22 | CMakePlugins/ CMake plugins 23 | extension/ Extension source code 24 | extension/chrome/ Google Chrome (Chromium) specific files 25 | extension/firefox/ Mozilla Firefox specific files 26 | extension/opera/ Opera specific files 27 | doc/ Documentation (Doxygen) 28 | plugin/ NPAPI-based plugin source code 29 | plugin/apple/ Apple (Darwin) specific files 30 | plugin/unix/ Unix-like specific files 31 | plugin/win/ Windows specific files 32 | ==================== ======================================= 33 | 34 | Building on Unix-like systems 35 | ----------------------------- 36 | a) Debug mode 37 | 38 | :: 39 | 40 | $ mkdir -p build/$(uname)/ && cd build/$(uname) 41 | $ cmake ../../ 42 | $ make 43 | 44 | b) Release mode 45 | 46 | :: 47 | 48 | $ mkdir -p build/$(uname)/ && cd build/$(uname) 49 | $ cmake -DCMAKE_BUILD_TYPE=Release ../../ 50 | $ make 51 | $ make Packages 52 | 53 | NOTE: (building 32bit plugin on 64bit system) 54 | $ cmake -DCMAKE_C_FLAGS=-m32 -DARCH=x86 -DCMAKE_BUILD_TYPE=Release ../../ 55 | 56 | NOTE 2: You will need crxmake.py script for generating debug 57 | Chrome extension .crx. 58 | You will probably need to run: 59 | $ chmod +x ./crxmake.py 60 | $ PATH="$PATH:$(pwd)" 61 | # or edit your .bashrc file to add the path during shell init 62 | Download crxmake.py from http://github.com/Constellation/crxmake. 63 | 64 | Building on Windows 65 | ------------------- 66 | 1. Run CMake (download `CMake `_) 67 | 2. Set source code path 68 | 3. Set build path (eg. source code path + /build/Windows) 69 | 4. Select build type 70 | 71 | a) Debug mode (development) 72 | 73 | Default 74 | 75 | b) Release mode (exports optimized shared library without debug messages) 76 | 77 | Set CMAKE_BUILDTYPE variable to "Release" value 78 | 79 | 5. Set XULRunnerSDK_INCLUDE_DIR (download `XULRunner SDK `_) 80 | 6. Click to Configure button 81 | 7. Select generator, eg. Visual Studio 2008 (64bit) 82 | 8. Click to Configure button again 83 | 9. Click to Generate button 84 | 10. Open generated project file and you are ready to develop 85 | -------------------------------------------------------------------------------- /plugin/unix/dig.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | #include "debug.h" 4 | #include "identifier.h" 5 | #include "init_modules.h" 6 | #include "module.h" 7 | #include "npapi.h" 8 | #include "shell.h" 9 | 10 | /* DIG module */ 11 | module *dig = NULL; 12 | 13 | /** 14 | * Object DIG 15 | * Used for distinguish DIG object passed from JavaScript 16 | */ 17 | typedef struct _object_dig { 18 | object obj; 19 | } object_dig; 20 | 21 | /** 22 | * DIG settings 23 | */ 24 | /* 25 | static struct { 26 | } settings = {0}; 27 | */ 28 | 29 | static bool 30 | invokeMethod(NPObject *obj, NPIdentifier identifier, const NPVariant *args, uint32_t argc, NPVariant *result) 31 | { 32 | char *argv[20]; 33 | int i; 34 | char *ptr; 35 | 36 | if (identifier == identifiers->start) { 37 | 38 | DEBUG_STR("plugin->dig->invokeMethod(%s): true", DEBUG_IDENTIFIER(identifier)); 39 | 40 | /* Just the URL argument can be passed from JavaScript */ 41 | if (argc != 1 || args[0].type != NPVariantType_String) 42 | return false; 43 | 44 | /* First argument should be command path/name */ 45 | i = 0; 46 | argv[i++] = ((shell_module *)dig)->path; 47 | 48 | /* Set the URL as the last argument */ 49 | argv[i++] = (char *)STRING_UTF8CHARACTERS(args[0].value.stringValue); 50 | 51 | /* Set NULL-terminating argument */ 52 | argv[i++] = NULL; 53 | 54 | OBJECT_TO_NPVARIANT(browser->createobject(((object *)obj)->instance, &processClass), *result); 55 | 56 | if (shell->run((process *)result->value.objectValue, ((shell_module *)dig)->path, argv)) 57 | return true; 58 | else 59 | return false; 60 | } 61 | 62 | DEBUG_STR("plugin->dig->invokeMethod(%s): false", DEBUG_IDENTIFIER(identifier)); 63 | return false; 64 | } 65 | 66 | static bool 67 | hasProperty(NPObject *obj, NPIdentifier identifier) 68 | { 69 | if (identifier == identifiers->found) { 70 | DEBUG_STR("plugin->dig->hasProperty(%s): true", DEBUG_IDENTIFIER(identifier)); 71 | return true; 72 | } 73 | DEBUG_STR("plugin->dig->hasProperty(%s): false", DEBUG_IDENTIFIER(identifier)); 74 | return false; 75 | } 76 | 77 | static bool 78 | getProperty(NPObject *obj, NPIdentifier identifier, NPVariant *value) 79 | { 80 | if (identifier == identifiers->found) { 81 | DEBUG_STR("plugin->dig->getProperty(%s): true", DEBUG_IDENTIFIER(identifier)); 82 | BOOLEAN_TO_NPVARIANT(((shell_module *)dig)->found, *value); 83 | return true; 84 | } 85 | DEBUG_STR("plugin->dig->getProperty(%s): false", DEBUG_IDENTIFIER(identifier)); 86 | return false; 87 | } 88 | 89 | static bool 90 | setProperty(NPObject *obj, NPIdentifier identifier, const NPVariant *value) 91 | { 92 | DEBUG_STR("plugin->dig->setProperty(%s): false", DEBUG_IDENTIFIER(identifier)); 93 | return false; 94 | } 95 | 96 | static void 97 | destroy() 98 | { 99 | DEBUG_STR("dig->destroy()"); 100 | if (dig) 101 | shell->destroy_module((shell_module *)dig); 102 | } 103 | 104 | static NPObject * 105 | allocate(NPP instance, NPClass *class) 106 | { 107 | object_dig *obj; 108 | 109 | DEBUG_STR("plugin->dig->allocate()"); 110 | 111 | obj = browser->memalloc(sizeof(*obj)); 112 | ((object *)obj)->instance = instance; 113 | 114 | return (NPObject *)obj; 115 | } 116 | 117 | bool 118 | init_module_dig() 119 | { 120 | DEBUG_STR("dig->init()"); 121 | dig = (module *)shell->init_module("dig"); 122 | dig->destroy = destroy; 123 | dig->class = modules->class; 124 | dig->class.allocate = allocate; 125 | dig->class.invoke = invokeMethod; 126 | dig->class.hasProperty = hasProperty; 127 | dig->class.getProperty = getProperty; 128 | dig->class.setProperty = setProperty; 129 | 130 | return true; 131 | } 132 | -------------------------------------------------------------------------------- /plugin/unix/whois.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | #include "debug.h" 4 | #include "identifier.h" 5 | #include "init_modules.h" 6 | #include "module.h" 7 | #include "npapi.h" 8 | #include "shell.h" 9 | 10 | /* WHOIS module */ 11 | module *whois = NULL; 12 | 13 | /** 14 | * Object WHOIS 15 | * Used for distinguish WHOIS object passed from JavaScript 16 | */ 17 | typedef struct _object_whois { 18 | object obj; 19 | } object_whois; 20 | 21 | /** 22 | * WHOIS settings 23 | */ 24 | /* 25 | static struct { 26 | } settings = {0}; 27 | */ 28 | 29 | static bool 30 | invokeMethod(NPObject *obj, NPIdentifier identifier, const NPVariant *args, uint32_t argc, NPVariant *result) 31 | { 32 | char *argv[20]; 33 | int i; 34 | char *ptr; 35 | 36 | if (identifier == identifiers->start) { 37 | 38 | DEBUG_STR("plugin->whois->invokeMethod(%s): true", DEBUG_IDENTIFIER(identifier)); 39 | 40 | /* Just the URL argument can be passed from JavaScript */ 41 | if (argc != 1 || args[0].type != NPVariantType_String) 42 | return false; 43 | 44 | /* First argument should be command path/name */ 45 | i = 0; 46 | argv[i++] = ((shell_module *)whois)->path; 47 | 48 | /* Set the URL as the last argument */ 49 | argv[i++] = (char *)STRING_UTF8CHARACTERS(args[0].value.stringValue); 50 | 51 | /* Set NULL-terminating argument */ 52 | argv[i++] = NULL; 53 | 54 | OBJECT_TO_NPVARIANT(browser->createobject(((object *)obj)->instance, &processClass), *result); 55 | 56 | if (shell->run((process *)result->value.objectValue, ((shell_module *)whois)->path, argv)) 57 | return true; 58 | else 59 | return false; 60 | } 61 | 62 | DEBUG_STR("plugin->whois->invokeMethod(%s): false", DEBUG_IDENTIFIER(identifier)); 63 | return false; 64 | } 65 | 66 | static bool 67 | hasProperty(NPObject *obj, NPIdentifier identifier) 68 | { 69 | if (identifier == identifiers->found) { 70 | DEBUG_STR("plugin->whois->hasProperty(%s): true", DEBUG_IDENTIFIER(identifier)); 71 | return true; 72 | } 73 | DEBUG_STR("plugin->whois->hasProperty(%s): false", DEBUG_IDENTIFIER(identifier)); 74 | return false; 75 | } 76 | 77 | static bool 78 | getProperty(NPObject *obj, NPIdentifier identifier, NPVariant *value) 79 | { 80 | if (identifier == identifiers->found) { 81 | DEBUG_STR("plugin->whois->getProperty(%s): true", DEBUG_IDENTIFIER(identifier)); 82 | BOOLEAN_TO_NPVARIANT(((shell_module *)whois)->found, *value); 83 | return true; 84 | } 85 | DEBUG_STR("plugin->whois->getProperty(%s): false", DEBUG_IDENTIFIER(identifier)); 86 | return false; 87 | } 88 | 89 | static bool 90 | setProperty(NPObject *obj, NPIdentifier identifier, const NPVariant *value) 91 | { 92 | DEBUG_STR("plugin->whois->setProperty(%s): false", DEBUG_IDENTIFIER(identifier)); 93 | return false; 94 | } 95 | 96 | static void 97 | destroy() 98 | { 99 | DEBUG_STR("whois->destroy()"); 100 | if (whois) 101 | shell->destroy_module((shell_module *)whois); 102 | } 103 | 104 | static NPObject * 105 | allocate(NPP instance, NPClass *class) 106 | { 107 | object_whois *obj; 108 | 109 | DEBUG_STR("plugin->whois->allocate()"); 110 | 111 | obj = browser->memalloc(sizeof(*obj)); 112 | ((object *)obj)->instance = instance; 113 | 114 | return (NPObject *)obj; 115 | } 116 | 117 | bool 118 | init_module_whois() 119 | { 120 | DEBUG_STR("whois->init()"); 121 | whois = (module *)shell->init_module("whois"); 122 | whois->destroy = destroy; 123 | whois->class = modules->class; 124 | whois->class.allocate = allocate; 125 | whois->class.invoke = invokeMethod; 126 | whois->class.hasProperty = hasProperty; 127 | whois->class.getProperty = getProperty; 128 | whois->class.setProperty = setProperty; 129 | 130 | return true; 131 | } 132 | -------------------------------------------------------------------------------- /plugin/process.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | #include "config.h" 6 | #include "debug.h" 7 | #include "identifier.h" 8 | #include "npapi.h" 9 | #include "plugin.h" 10 | #include "process.h" 11 | #include "module.h" 12 | #include "shell.h" 13 | 14 | static bool 15 | hasMethod(NPObject *obj, NPIdentifier identifier) 16 | { 17 | if (identifier == identifiers->read) { 18 | DEBUG_STR("process->hasMethod(%s): true", DEBUG_IDENTIFIER(identifier)); 19 | return true; 20 | } 21 | 22 | if (identifier == identifiers->stop) { 23 | DEBUG_STR("process->hasMethod(%s): true", DEBUG_IDENTIFIER(identifier)); 24 | return true; 25 | } 26 | 27 | DEBUG_STR("process->hasMethod(%s): false", DEBUG_IDENTIFIER(identifier)); 28 | return false; 29 | } 30 | 31 | static bool 32 | invokeMethod(NPObject *obj, NPIdentifier identifier, const NPVariant *args, uint32_t argc, NPVariant *result) 33 | { 34 | /* Read data from process */ 35 | if (identifier == identifiers->read) { 36 | 37 | DEBUG_STR("process->invokeMethod(read)"); 38 | 39 | if (!shell->read((process *)obj, result)) { 40 | DEBUG_STR("process->invokeMethod(read): false"); 41 | BOOLEAN_TO_NPVARIANT(false, *result); 42 | } 43 | 44 | return true; 45 | } 46 | 47 | /* Stop/kill the process */ 48 | if (identifier == identifiers->stop) { 49 | 50 | DEBUG_STR("process->invokeMethod(stop)"); 51 | 52 | if (shell->stop((process *)obj)) { 53 | BOOLEAN_TO_NPVARIANT(true, *result); 54 | } else { 55 | DEBUG_STR("process->invokeMethod(stop): false"); 56 | BOOLEAN_TO_NPVARIANT(false, *result); 57 | } 58 | 59 | return true; 60 | } 61 | 62 | DEBUG_STR("process->invokeMethod(%s): false", DEBUG_IDENTIFIER(identifier)); 63 | return false; 64 | } 65 | 66 | static bool 67 | invokeDefault(NPObject *obj, const NPVariant *args, const uint32_t argCount, NPVariant *result) 68 | { 69 | DEBUG_STR("process->invokeDefault(): false"); 70 | return false; 71 | } 72 | 73 | static bool 74 | hasProperty(NPObject *obj, NPIdentifier identifier) 75 | { 76 | if (identifier == identifiers->running) { 77 | DEBUG_STR("process->hasProperty(running): %s", ((process *)obj)->running ? "true" : "false"); 78 | return true; 79 | } 80 | 81 | DEBUG_STR("process->hasProperty(%s): false", DEBUG_IDENTIFIER(identifier)); 82 | return false; 83 | } 84 | 85 | static bool 86 | getProperty(NPObject *obj, NPIdentifier identifier, NPVariant *result) 87 | { 88 | if (identifier == identifiers->running) { 89 | DEBUG_STR("process->getProperty(running): %s", ((process *)obj)->running ? "true" : "false"); 90 | BOOLEAN_TO_NPVARIANT(((process *)obj)->running, *result); 91 | return true; 92 | } 93 | 94 | DEBUG_STR("process->hasProperty(%s): false", DEBUG_IDENTIFIER(identifier)); 95 | return false; 96 | } 97 | 98 | static NPObject * 99 | allocate(NPP instance, NPClass *class) 100 | { 101 | process *p; 102 | 103 | DEBUG_STR("process->allocate()"); 104 | 105 | p = browser->memalloc(sizeof(*p)); 106 | p->running = false; 107 | 108 | return (NPObject *)p; 109 | } 110 | 111 | static void 112 | deallocate(NPObject *obj) 113 | { 114 | DEBUG_STR("process->deallocate()"); 115 | 116 | /* Process is still running */ 117 | if (((process *)obj)->running) 118 | shell->stop((process *)obj); 119 | 120 | browser->memfree(obj); 121 | } 122 | 123 | NPClass processClass = { 124 | NP_CLASS_STRUCT_VERSION, 125 | allocate, 126 | deallocate, 127 | NULL/*invalidate*/, 128 | hasMethod, 129 | invokeMethod, 130 | invokeDefault, 131 | hasProperty, 132 | getProperty, 133 | NULL/*setProperty*/, 134 | NULL/*removeProperty*/, 135 | NULL/*enumerate*/, 136 | NULL/*construct*/ 137 | }; 138 | -------------------------------------------------------------------------------- /plugin/module.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | #include "debug.h" 4 | #include "npapi.h" 5 | #include "identifier.h" 6 | #include "init_modules.h" 7 | #include "shell.h" 8 | 9 | module *modules = NULL; 10 | 11 | static bool 12 | hasMethod(NPObject *obj, NPIdentifier identifier) 13 | { 14 | if (identifier == identifiers->start) { 15 | DEBUG_STR("plugin->module->hasMethod(%s): true", DEBUG_IDENTIFIER(identifier)); 16 | return true; 17 | } 18 | 19 | DEBUG_STR("plugin->module->hasMethod(%s): false", DEBUG_IDENTIFIER(identifier)); 20 | return false; 21 | } 22 | 23 | static bool 24 | invokeMethod(NPObject *obj, NPIdentifier identifier, const NPVariant *args, uint32_t argc, NPVariant *result) 25 | { 26 | DEBUG_STR("plugin->module->invokeMethod(%s): false", DEBUG_IDENTIFIER(identifier)); 27 | return false; 28 | } 29 | 30 | static bool 31 | invokeDefault(NPObject *obj, const NPVariant *args, const uint32_t argCount, NPVariant *result) 32 | { 33 | DEBUG_STR("plugin->module->invokeDefault(): false"); 34 | return false; 35 | } 36 | 37 | static bool 38 | hasProperty(NPObject *obj, NPIdentifier identifier) 39 | { 40 | DEBUG_STR("plugin->module->hasProperty(%s): false", DEBUG_IDENTIFIER(identifier)); 41 | return false; 42 | } 43 | 44 | static bool 45 | getProperty(NPObject *obj, NPIdentifier identifier, NPVariant *result) 46 | { 47 | DEBUG_STR("plugin->module->getProperty(%s): false", DEBUG_IDENTIFIER(identifier)); 48 | return false; 49 | } 50 | 51 | NPClass class = { 52 | NP_CLASS_STRUCT_VERSION, 53 | NULL/*allocate*/, 54 | NULL/*deallocate*/, 55 | NULL/*invalidate*/, 56 | hasMethod, 57 | invokeMethod, 58 | invokeDefault, 59 | hasProperty, 60 | getProperty, 61 | NULL/*setProperty*/, 62 | NULL/*removeProperty*/, 63 | NULL/*enumerate*/, 64 | NULL/*construct*/ 65 | }; 66 | 67 | static void 68 | destroy() 69 | { 70 | DEBUG_STR("modules->destroy()"); 71 | 72 | #ifdef MODULE_IPCONFIG 73 | if (ipconfig) 74 | ipconfig->destroy(); 75 | #endif 76 | 77 | #ifdef MODULE_NMAP 78 | if (nmap) 79 | nmap->destroy(); 80 | #endif 81 | 82 | #ifdef MODULE_DIG 83 | if (dig) 84 | dig->destroy(); 85 | #endif 86 | 87 | #ifdef MODULE_WHOIS 88 | if (whois) 89 | whois->destroy(); 90 | #endif 91 | 92 | #ifdef MODULE_NSLOOKUP 93 | if (nslookup) 94 | nslookup->destroy(); 95 | #endif 96 | 97 | #ifdef MODULE_TRACEROUTE6 98 | if (traceroute6) 99 | traceroute6->destroy(); 100 | #endif 101 | 102 | #ifdef MODULE_TRACEROUTE 103 | if (traceroute) 104 | traceroute->destroy(); 105 | #endif 106 | 107 | #ifdef MODULE_PING6 108 | if (ping6) 109 | ping6->destroy(); 110 | #endif 111 | 112 | #ifdef MODULE_PING 113 | if (ping) 114 | ping->destroy(); 115 | #endif 116 | 117 | if (modules) 118 | browser->memfree(modules); 119 | 120 | if (shell) 121 | shell->destroy(); 122 | } 123 | 124 | bool 125 | init_modules() 126 | { 127 | DEBUG_STR("modules->init()"); 128 | 129 | if (!init_shell()) 130 | return false; 131 | 132 | modules = browser->memalloc(sizeof(*modules)); 133 | if (!modules) 134 | return false; 135 | 136 | modules->class = class; 137 | modules->destroy = destroy; 138 | 139 | #ifdef MODULE_PING 140 | if (!init_module_ping()) 141 | return false; 142 | #endif 143 | 144 | #ifdef MODULE_PING6 145 | if (!init_module_ping6()) 146 | return false; 147 | #endif 148 | 149 | #ifdef MODULE_TRACEROUTE 150 | if (!init_module_traceroute()) 151 | return false; 152 | #endif 153 | 154 | #ifdef MODULE_TRACEROUTE6 155 | if (!init_module_traceroute6()) 156 | return false; 157 | #endif 158 | 159 | #ifdef MODULE_NSLOOKUP 160 | if (!init_module_nslookup()) 161 | return false; 162 | #endif 163 | 164 | #ifdef MODULE_WHOIS 165 | if (!init_module_whois()) 166 | return false; 167 | #endif 168 | 169 | #ifdef MODULE_DIG 170 | if (!init_module_dig()) 171 | return false; 172 | #endif 173 | 174 | #ifdef MODULE_NMAP 175 | if (!init_module_nmap()) 176 | return false; 177 | #endif 178 | 179 | #ifdef MODULE_IPCONFIG 180 | if (!init_module_ipconfig()) 181 | return false; 182 | #endif 183 | 184 | return true; 185 | } 186 | -------------------------------------------------------------------------------- /extension/js/jquery/jquery.flot.navigate.js: -------------------------------------------------------------------------------- 1 | (function(R){R.fn.drag=function(A,B,C){if(B){this.bind("dragstart",A)}if(C){this.bind("dragend",C)}return !A?this.trigger("drag"):this.bind("drag",B?B:A)};var M=R.event,L=M.special,Q=L.drag={not:":input",distance:0,which:1,dragging:false,setup:function(A){A=R.extend({distance:Q.distance,which:Q.which,not:Q.not},A||{});A.distance=N(A.distance);M.add(this,"mousedown",O,A);if(this.attachEvent){this.attachEvent("ondragstart",J)}},teardown:function(){M.remove(this,"mousedown",O);if(this===Q.dragging){Q.dragging=Q.proxy=false}P(this,true);if(this.detachEvent){this.detachEvent("ondragstart",J)}}};L.dragstart=L.dragend={setup:function(){},teardown:function(){}};function O(A){var B=this,C,D=A.data||{};if(D.elem){B=A.dragTarget=D.elem;A.dragProxy=Q.proxy||B;A.cursorOffsetX=D.pageX-D.left;A.cursorOffsetY=D.pageY-D.top;A.offsetX=A.pageX-A.cursorOffsetX;A.offsetY=A.pageY-A.cursorOffsetY}else{if(Q.dragging||(D.which>0&&A.which!=D.which)||R(A.target).is(D.not)){return }}switch(A.type){case"mousedown":R.extend(D,R(B).offset(),{elem:B,target:A.target,pageX:A.pageX,pageY:A.pageY});M.add(document,"mousemove mouseup",O,D);P(B,false);Q.dragging=null;return false;case !Q.dragging&&"mousemove":if(N(A.pageX-D.pageX)+N(A.pageY-D.pageY)Z[1]))){return }a.min=X;a.max=T}K(G,F,"xaxis");K(G,F,"x2axis");K(P,O,"yaxis");K(P,O,"y2axis");D.setupGrid();D.draw();if(!M.preventEvent){D.getPlaceholder().trigger("plotzoom",[D])}};D.pan=function(I){var F=+I.left,J=+I.top,K=D.getAxes(),H=D.getOptions();if(isNaN(F)){F=0}if(isNaN(J)){J=0}function G(R,M){var O=K[M],Q=H[M],N,L;if(!O.used){return }N=O.c2p(O.p2c(O.min)+R),L=O.c2p(O.p2c(O.max)+R);var P=Q.panRange;if(P){if(P[0]!=null&&P[0]>N){R=P[0]-N;N+=R;L+=R}if(P[1]!=null&&P[1] 2 | #include 3 | #include 4 | 5 | #include "config.h" 6 | #include "debug.h" 7 | #include "npapi.h" 8 | #include "plugin.h" 9 | #include "module.h" 10 | #include "identifier.h" 11 | #include "init_modules.h" 12 | 13 | /*! NPAPI variables */ 14 | NPNetscapeFuncs *browser = NULL; 15 | 16 | static NPError 17 | init(const NPMIMEType pluginType, const NPP _instance, const uint16_t mode, int16_t argc, char *argn[], char *argv[], NPSavedData *saved) 18 | { 19 | return NPERR_NO_ERROR; 20 | } 21 | 22 | static NPError 23 | destroy(NPP instance, NPSavedData **save) 24 | { 25 | return NPERR_NO_ERROR; 26 | } 27 | 28 | static NPError 29 | getValue(NPP instance, const NPPVariable variable, void *value) 30 | { 31 | switch (variable) { 32 | case NPPVpluginNameString: 33 | DEBUG_STR("getValue(NPPVPluginNameString)"); 34 | *((char **)value) = PLUGIN_NAME; 35 | break; 36 | case NPPVpluginDescriptionString: 37 | DEBUG_STR("getValue(NPPVPluginDescriptionString)"); 38 | *((char **)value) = PLUGIN_DESC; 39 | break; 40 | case NPPVpluginScriptableNPObject: 41 | DEBUG_STR("getValue(NPPVpluginScriptableNPObject)"); 42 | *(NPObject **)value = browser->createobject(instance, &pluginClass); 43 | break; 44 | case NPPVpluginNeedsXEmbed: 45 | DEBUG_STR("getValue(NPPVpluginNeedsXEmbed)"); 46 | /* This plugin use XEmbed instead of using the old Xt-based mainloop */ 47 | *((bool *)value) = true; 48 | break; 49 | case NPPVpluginKeepLibraryInMemory: 50 | DEBUG_STR("getValue(NPPVpluginKeepLibraryInMemory)"); 51 | *((bool *)value) = true; 52 | break; 53 | default: 54 | DEBUG_STR("getValue(%d) - ERROR", variable); 55 | return NPERR_GENERIC_ERROR; 56 | } 57 | return NPERR_NO_ERROR; 58 | } 59 | 60 | static NPError /* expected by Safari on Darwin */ 61 | handleEvent(NPP instance, void *ev) 62 | { 63 | DEBUG_STR("handleEvent()"); 64 | return NPERR_NO_ERROR; 65 | } 66 | 67 | static NPError /* expected by Opera */ 68 | setWindow(NPP instance, NPWindow* pNPWindow) 69 | { 70 | DEBUG_STR("setWindow()"); 71 | return NPERR_NO_ERROR; 72 | } 73 | 74 | NPError OSCALL 75 | NP_GetEntryPoints(NPPluginFuncs *nppfuncs) 76 | { 77 | DEBUG_STR("NP_GetEntryPoints()"); 78 | nppfuncs->version = (NP_VERSION_MAJOR << 8) | NP_VERSION_MINOR; 79 | //nppfuncs->size = sizeof(*nppfuncs); 80 | nppfuncs->newp = init; 81 | nppfuncs->destroy = destroy; 82 | nppfuncs->getvalue = getValue; 83 | nppfuncs->event = handleEvent; 84 | nppfuncs->setwindow = setWindow; 85 | //pluginFuncs->newstream = NewNPP_NewStreamProc(Private_NewStream); 86 | //pluginFuncs->destroystream = NewNPP_DestroyStreamProc(Private_DestroyStream); 87 | //pluginFuncs->asfile = NewNPP_StreamAsFileProc(Private_StreamAsFile); 88 | //pluginFuncs->writeready = NewNPP_WriteReadyProc(Private_WriteReady); 89 | //pluginFuncs->write = NewNPP_WriteProc(Private_Write); 90 | //pluginFuncs->print = NewNPP_PrintProc(Private_Print); 91 | //pluginFuncs->urlnotify = NewNPP_URLNotifyProc(Private_URLNotify); 92 | //pluginFuncs->getvalue = NewNPP_GetValueProc(Private_GetValue); 93 | #ifdef OJI 94 | //pluginFuncs->javaClass = Private_GetJavaClass(); 95 | #endif 96 | return NPERR_NO_ERROR; 97 | } 98 | 99 | NPError OSCALL 100 | NP_Initialize(NPNetscapeFuncs *npnf 101 | #if defined(ANDROID) 102 | , NPPluginFuncs *nppfuncs, JNIEnv *env, jobject plugin_object 103 | #elif !defined(_WINDOWS) && !defined(__APPLE__) 104 | , NPPluginFuncs *nppfuncs 105 | #endif 106 | ) 107 | { 108 | DEBUG_STR("NP_Initialize()"); 109 | 110 | if (npnf == NULL) 111 | return NPERR_INVALID_FUNCTABLE_ERROR; 112 | 113 | if (HIBYTE(npnf->version) > NP_VERSION_MAJOR) 114 | return NPERR_INCOMPATIBLE_VERSION_ERROR; 115 | 116 | browser = npnf; 117 | #if !defined(_WINDOWS) && !defined(__APPLE__) 118 | NP_GetEntryPoints(nppfuncs); 119 | #endif 120 | 121 | if (!init_identifiers()) 122 | return NPERR_MODULE_LOAD_FAILED_ERROR; 123 | 124 | if (!init_modules()) 125 | return NPERR_MODULE_LOAD_FAILED_ERROR; 126 | 127 | return NPERR_NO_ERROR; 128 | } 129 | 130 | NPError OSCALL 131 | NP_Shutdown() 132 | { 133 | DEBUG_STR("NP_Shutdown()"); 134 | 135 | if (modules) 136 | modules->destroy(); 137 | 138 | if (identifiers) 139 | identifiers->destroy(); 140 | 141 | return NPERR_NO_ERROR; 142 | } 143 | 144 | char * 145 | NP_GetMIMEDescription() 146 | { 147 | DEBUG_STR("NP_GetMIMEDescription()"); 148 | return PLUGIN_MIME; 149 | } 150 | 151 | NPError OSCALL /* needs to be present for WebKit based browsers */ 152 | NP_GetValue(void *npp, NPPVariable variable, void *value) 153 | { 154 | DEBUG_STR("NP_GetValue()"); 155 | return getValue((NPP)npp, variable, value); 156 | } -------------------------------------------------------------------------------- /plugin/api/conetserv.h: -------------------------------------------------------------------------------- 1 | /*! 2 | * \brief CoNetServ object 3 | * 4 | * CoNetServ plugin should be loaded into (X)HTML document using object tag: 5 | * 6 | * Plugin FAILED to load 7 | * 8 | * 9 | * Getting JavaScript variable from object tag: 10 | * var conetserv = document.getElementById("conetserv"); 11 | * 12 | */ 13 | class conetserv { 14 | 15 | /*! 16 | * \brief Plugin version 17 | */ 18 | string version = "2.0.0"; 19 | 20 | /*! 21 | * \brief PING command 22 | */ 23 | class ping { 24 | 25 | /*! 26 | * \brief Start ping command 27 | * @return bool True if success, false otherwise. 28 | */ 29 | bool start() { 30 | /* Native code */ 31 | }; 32 | 33 | /*! 34 | * \brief Stop ping command 35 | * @return bool True if success, false otherwise. 36 | */ 37 | bool stop() { 38 | /* Native code */ 39 | }; 40 | 41 | /*! 42 | * \breaf Read ping command output 43 | * @return string Data output. 44 | */ 45 | string read() { 46 | /* Native code */ 47 | }; 48 | 49 | }; 50 | 51 | /*! 52 | * \brief PING6 comand 53 | */ 54 | class ping6 { 55 | 56 | /*! 57 | * \brief Start ping6 command 58 | * @return bool True if success, false otherwise. 59 | */ 60 | bool start() { 61 | /* Native code */ 62 | }; 63 | 64 | /*! 65 | * \brief Stop ping6 command 66 | * @return bool True if success, false otherwise. 67 | */ 68 | bool stop() { 69 | /* Native code */ 70 | }; 71 | 72 | /*! 73 | * \breaf Read ping6 command output 74 | * @return string Data output. 75 | */ 76 | string read() { 77 | /* Native code */ 78 | }; 79 | 80 | }; 81 | 82 | /** 83 | * \brief TRACEROUTE command 84 | */ 85 | class traceroute { 86 | 87 | /*! 88 | * \brief Start traceroute command 89 | * @return bool True if success, false otherwise. 90 | */ 91 | bool start() { 92 | /* Native code */ 93 | }; 94 | 95 | /*! 96 | * \brief Stop traceroute command 97 | * @return bool True if success, false otherwise. 98 | */ 99 | bool stop() { 100 | /* Native code */ 101 | }; 102 | 103 | /*! 104 | * \breaf Read traceroute command output 105 | * @return string Data output. 106 | */ 107 | string read() { 108 | /* Native code */ 109 | }; 110 | 111 | }; 112 | 113 | /** 114 | * \brief TRACEROUTE6 command 115 | */ 116 | class traceroute6 { 117 | 118 | /*! 119 | * \brief Start traceroute6 command 120 | * @return bool True if success, false otherwise. 121 | */ 122 | bool start() { 123 | /* Native code */ 124 | }; 125 | 126 | /*! 127 | * \brief Stop traceroute6 command 128 | * @return bool True if success, false otherwise. 129 | */ 130 | bool stop() { 131 | /* Native code */ 132 | }; 133 | 134 | /*! 135 | * \breaf Read traceroute6 command output 136 | * @return string Data output. 137 | */ 138 | string read() { 139 | /* Native code */ 140 | }; 141 | 142 | }; 143 | 144 | /** 145 | * \brief WHOIS command 146 | */ 147 | class whois { 148 | 149 | /*! 150 | * \brief Start whois command 151 | * @return bool True if success, false otherwise. 152 | */ 153 | bool start() { 154 | /* Native code */ 155 | }; 156 | 157 | /*! 158 | * \brief Stop whois command 159 | * @return bool True if success, false otherwise. 160 | */ 161 | bool stop() { 162 | /* Native code */ 163 | }; 164 | 165 | /*! 166 | * \breaf Read whois command output 167 | * @return string Data output. 168 | */ 169 | string read() { 170 | /* Native code */ 171 | }; 172 | 173 | }; 174 | 175 | /** 176 | * \brief NSLOOKUP command 177 | */ 178 | class nslookup { 179 | 180 | /*! 181 | * \brief Start nslookup command 182 | * @return bool True if success, false otherwise. 183 | */ 184 | bool start() { 185 | /* Native code */ 186 | }; 187 | 188 | /*! 189 | * \brief Stop nslookup command 190 | * @return bool True if success, false otherwise. 191 | */ 192 | bool stop() { 193 | /* Native code */ 194 | }; 195 | 196 | /*! 197 | * \breaf Read nslookup command output 198 | * @return string Data output. 199 | */ 200 | string read() { 201 | /* Native code */ 202 | }; 203 | 204 | }; 205 | 206 | }; 207 | -------------------------------------------------------------------------------- /plugin/common/traceroute.c: -------------------------------------------------------------------------------- 1 | /* TRACEROUTE and TRACEROUTE6 modules */ 2 | module *traceroute = NULL; 3 | module *traceroute6 = NULL; 4 | 5 | /** 6 | * Object TRACEROUTE - abstraction of TRACEROUTE and TRACEROUTE6 7 | * Used to distinguish TRACEROUTE and TRACEROUTE6 objects passed from JavaScript 8 | */ 9 | typedef struct _object_traceroute { 10 | object obj; 11 | shell_module *program; 12 | } object_traceroute; 13 | 14 | /** 15 | * TRACEROUTE settings 16 | * The same settings for both TRACEROUTE and TRACEROUTE6 17 | */ 18 | static struct { 19 | int maxhops; 20 | int waittime; 21 | bool iptohostname; 22 | } settings = {0}; 23 | 24 | static bool 25 | hasProperty(NPObject *obj, NPIdentifier identifier) 26 | { 27 | if (identifier == identifiers->found) { 28 | DEBUG_STR("plugin->traceroute->hasProperty(%s): true", DEBUG_IDENTIFIER(identifier)); 29 | return true; 30 | } 31 | if (identifier == identifiers->maxhops) { 32 | DEBUG_STR("plugin->traceroute->hasProperty(%s): true", DEBUG_IDENTIFIER(identifier)); 33 | return true; 34 | } 35 | if (identifier == identifiers->waittime) { 36 | DEBUG_STR("plugin->traceroute->hasProperty(%s): true", DEBUG_IDENTIFIER(identifier)); 37 | return true; 38 | } 39 | if (identifier == identifiers->iptohostname) { 40 | DEBUG_STR("plugin->traceroute->hasProperty(%s): true", DEBUG_IDENTIFIER(identifier)); 41 | return true; 42 | } 43 | DEBUG_STR("plugin->traceroute->hasProperty(%s): false", DEBUG_IDENTIFIER(identifier)); 44 | return false; 45 | } 46 | 47 | static bool 48 | getProperty(NPObject *obj, NPIdentifier identifier, NPVariant *value) 49 | { 50 | if (identifier == identifiers->found) { 51 | DEBUG_STR("plugin->traceroute->getProperty(%s): true", DEBUG_IDENTIFIER(identifier)); 52 | BOOLEAN_TO_NPVARIANT(((object_traceroute *)obj)->program->found, *value); 53 | return true; 54 | } 55 | if (identifier == identifiers->maxhops) { 56 | DEBUG_STR("plugin->traceroute->hasProperty(%s): true", DEBUG_IDENTIFIER(identifier)); 57 | INT32_TO_NPVARIANT(settings.maxhops, *value); 58 | return true; 59 | } 60 | if (identifier == identifiers->waittime) { 61 | DEBUG_STR("plugin->traceroute->hasProperty(%s): true", DEBUG_IDENTIFIER(identifier)); 62 | INT32_TO_NPVARIANT(settings.waittime, *value); 63 | return true; 64 | } 65 | if (identifier == identifiers->iptohostname) { 66 | DEBUG_STR("plugin->traceroute->hasProperty(%s): true", DEBUG_IDENTIFIER(identifier)); 67 | BOOLEAN_TO_NPVARIANT(settings.iptohostname, *value); 68 | return true; 69 | } 70 | DEBUG_STR("plugin->traceroute->getProperty(%s): false", DEBUG_IDENTIFIER(identifier)); 71 | return false; 72 | } 73 | 74 | static bool 75 | setProperty(NPObject *obj, NPIdentifier identifier, const NPVariant *value) 76 | { 77 | if (identifier == identifiers->maxhops) { 78 | DEBUG_STR("plugin->traceroute->hasProperty(%s): true", DEBUG_IDENTIFIER(identifier)); 79 | settings.maxhops = NPVARIANT_TO_INT32(*value); 80 | return true; 81 | } 82 | if (identifier == identifiers->waittime) { 83 | DEBUG_STR("plugin->traceroute->hasProperty(%s): true", DEBUG_IDENTIFIER(identifier)); 84 | settings.waittime = NPVARIANT_TO_INT32(*value); 85 | return true; 86 | } 87 | if (identifier == identifiers->iptohostname) { 88 | DEBUG_STR("plugin->traceroute->hasProperty(%s): true", DEBUG_IDENTIFIER(identifier)); 89 | settings.iptohostname = NPVARIANT_TO_BOOLEAN(*value); 90 | return true; 91 | } 92 | DEBUG_STR("plugin->traceroute->setProperty(%s): false", DEBUG_IDENTIFIER(identifier)); 93 | return false; 94 | } 95 | 96 | static void 97 | destroy_traceroute() 98 | { 99 | DEBUG_STR("traceroute->destroy()"); 100 | if (traceroute) 101 | shell->destroy_module((shell_module *)traceroute); 102 | } 103 | 104 | static void 105 | destroy_traceroute6() 106 | { 107 | DEBUG_STR("traceroute6->destroy()"); 108 | if (traceroute6) 109 | shell->destroy_module((shell_module *)traceroute6); 110 | } 111 | 112 | static NPObject * 113 | allocate_traceroute(NPP instance, NPClass *class) 114 | { 115 | object_traceroute *obj; 116 | 117 | DEBUG_STR("plugin->traceroute->allocate()"); 118 | 119 | obj = browser->memalloc(sizeof(*obj)); 120 | ((object *)obj)->instance = instance; 121 | obj->program = (shell_module *)traceroute; 122 | 123 | return (NPObject *)obj; 124 | } 125 | 126 | static NPObject * 127 | allocate_traceroute6(NPP instance, NPClass *class) 128 | { 129 | object_traceroute *obj; 130 | 131 | DEBUG_STR("plugin->traceroute6->allocate()"); 132 | 133 | obj = browser->memalloc(sizeof(*obj)); 134 | ((object *)obj)->instance = instance; 135 | obj->program = (shell_module *)traceroute6; 136 | 137 | return (NPObject *)obj; 138 | } 139 | 140 | bool 141 | init_module_traceroute() 142 | { 143 | DEBUG_STR("traceroute->init()"); 144 | traceroute = (module *)shell->init_module("traceroute"); 145 | traceroute->destroy = destroy_traceroute; 146 | traceroute->class = modules->class; 147 | traceroute->class.allocate = allocate_traceroute; 148 | traceroute->class.invoke = invokeMethod; 149 | traceroute->class.hasProperty = hasProperty; 150 | traceroute->class.getProperty = getProperty; 151 | traceroute->class.setProperty = setProperty; 152 | 153 | return true; 154 | } 155 | 156 | bool 157 | init_module_traceroute6() 158 | { 159 | DEBUG_STR("traceroute6->init()"); 160 | traceroute6 = (module *)shell->init_module("traceroute6"); 161 | traceroute6->destroy = destroy_traceroute6; 162 | traceroute6->class = modules->class; 163 | traceroute6->class.allocate = allocate_traceroute6; 164 | traceroute6->class.invoke = invokeMethod; 165 | traceroute6->class.hasProperty = hasProperty; 166 | traceroute6->class.getProperty = getProperty; 167 | traceroute6->class.setProperty = setProperty; 168 | 169 | return true; 170 | } 171 | -------------------------------------------------------------------------------- /plugin/common/ping.c: -------------------------------------------------------------------------------- 1 | /* PING and PING6 modules */ 2 | module *ping = NULL; 3 | module *ping6 = NULL; 4 | 5 | /** 6 | * Object PING - abstraction of PING and PING6 7 | * Used to distinguish PING and PING6 objects passed from JavaScript 8 | */ 9 | typedef struct _object_ping { 10 | object obj; 11 | shell_module *program; 12 | } object_ping; 13 | 14 | /** 15 | * PING settings 16 | * The same settings for both PING and PING6 17 | */ 18 | static struct { 19 | int count; 20 | int timeout; 21 | int packetsize; 22 | int ttl; 23 | } settings = {0}; 24 | 25 | static bool 26 | hasProperty(NPObject *obj, NPIdentifier identifier) 27 | { 28 | if (identifier == identifiers->found) { 29 | DEBUG_STR("plugin->ping->hasProperty(%s): true", DEBUG_IDENTIFIER(identifier)); 30 | return true; 31 | } 32 | if (identifier == identifiers->count) { 33 | DEBUG_STR("plugin->ping->hasProperty(%s): true", DEBUG_IDENTIFIER(identifier)); 34 | return true; 35 | } 36 | if (identifier == identifiers->timeout) { 37 | DEBUG_STR("plugin->ping->hasProperty(%s): true", DEBUG_IDENTIFIER(identifier)); 38 | return true; 39 | } 40 | if (identifier == identifiers->packetsize) { 41 | DEBUG_STR("plugin->ping->hasProperty(%s): true", DEBUG_IDENTIFIER(identifier)); 42 | return true; 43 | } 44 | if (identifier == identifiers->ttl) { 45 | DEBUG_STR("plugin->ping->hasProperty(%s): true", DEBUG_IDENTIFIER(identifier)); 46 | return true; 47 | } 48 | DEBUG_STR("plugin->ping->hasProperty(%s): false", DEBUG_IDENTIFIER(identifier)); 49 | return false; 50 | } 51 | 52 | static bool 53 | getProperty(NPObject *obj, NPIdentifier identifier, NPVariant *value) 54 | { 55 | if (identifier == identifiers->found) { 56 | DEBUG_STR("plugin->ping->getProperty(%s): true", DEBUG_IDENTIFIER(identifier)); 57 | BOOLEAN_TO_NPVARIANT(((object_ping *)obj)->program->found, *value); 58 | return true; 59 | } 60 | if (identifier == identifiers->count) { 61 | DEBUG_STR("plugin->ping->getProperty(%s): true", DEBUG_IDENTIFIER(identifier)); 62 | INT32_TO_NPVARIANT(settings.count, *value); 63 | return true; 64 | } 65 | if (identifier == identifiers->timeout) { 66 | DEBUG_STR("plugin->ping->getProperty(%s): true", DEBUG_IDENTIFIER(identifier)); 67 | INT32_TO_NPVARIANT(settings.timeout, *value); 68 | return true; 69 | } 70 | if (identifier == identifiers->packetsize) { 71 | DEBUG_STR("plugin->ping->getProperty(%s): true", DEBUG_IDENTIFIER(identifier)); 72 | INT32_TO_NPVARIANT(settings.packetsize, *value); 73 | return true; 74 | } 75 | if (identifier == identifiers->ttl) { 76 | DEBUG_STR("plugin->ping->getProperty(%s): true", DEBUG_IDENTIFIER(identifier)); 77 | INT32_TO_NPVARIANT(settings.ttl, *value); 78 | return true; 79 | } 80 | DEBUG_STR("plugin->ping->getProperty(%s): false", DEBUG_IDENTIFIER(identifier)); 81 | return false; 82 | } 83 | 84 | static bool 85 | setProperty(NPObject *obj, NPIdentifier identifier, const NPVariant *value) 86 | { 87 | if (identifier == identifiers->count) { 88 | DEBUG_STR("plugin->ping->setProperty(%s): true", DEBUG_IDENTIFIER(identifier)); 89 | settings.count = NPVARIANT_TO_INT32(*value); 90 | return true; 91 | } 92 | if (identifier == identifiers->timeout) { 93 | DEBUG_STR("plugin->ping->setProperty(%s): true", DEBUG_IDENTIFIER(identifier)); 94 | settings.timeout = NPVARIANT_TO_INT32(*value); 95 | return true; 96 | } 97 | if (identifier == identifiers->packetsize) { 98 | DEBUG_STR("plugin->ping->setProperty(%s): true", DEBUG_IDENTIFIER(identifier)); 99 | settings.packetsize = NPVARIANT_TO_INT32(*value); 100 | return true; 101 | } 102 | if (identifier == identifiers->ttl) { 103 | DEBUG_STR("plugin->ping->setProperty(%s): true", DEBUG_IDENTIFIER(identifier)); 104 | settings.ttl = NPVARIANT_TO_INT32(*value); 105 | return true; 106 | } 107 | DEBUG_STR("plugin->ping->setProperty(%s): false", DEBUG_IDENTIFIER(identifier)); 108 | return false; 109 | } 110 | 111 | static void 112 | destroy_ping() 113 | { 114 | DEBUG_STR("ping->destroy()"); 115 | if (ping) 116 | shell->destroy_module((shell_module *)ping); 117 | } 118 | 119 | static void 120 | destroy_ping6() 121 | { 122 | DEBUG_STR("ping6->destroy()"); 123 | if (ping6) 124 | shell->destroy_module((shell_module *)ping6); 125 | } 126 | 127 | static NPObject * 128 | allocate_ping(NPP instance, NPClass *class) 129 | { 130 | object_ping *obj; 131 | 132 | DEBUG_STR("plugin->ping->allocate()"); 133 | 134 | obj = browser->memalloc(sizeof(*obj)); 135 | ((object *)obj)->instance = instance; 136 | obj->program = (shell_module *)ping; 137 | 138 | return (NPObject *)obj; 139 | } 140 | 141 | static NPObject * 142 | allocate_ping6(NPP instance, NPClass *class) 143 | { 144 | object_ping *obj; 145 | 146 | DEBUG_STR("plugin->ping6->allocate()"); 147 | 148 | obj = browser->memalloc(sizeof(*obj)); 149 | ((object *)obj)->instance = instance; 150 | obj->program = (shell_module *)ping6; 151 | 152 | return (NPObject *)obj; 153 | } 154 | 155 | bool 156 | init_module_ping() 157 | { 158 | DEBUG_STR("ping->init()"); 159 | ping = (module *)shell->init_module("ping"); 160 | ping->destroy = destroy_ping; 161 | ping->class = modules->class; 162 | ping->class.allocate = allocate_ping; 163 | ping->class.invoke = invokeMethod; 164 | ping->class.hasProperty = hasProperty; 165 | ping->class.getProperty = getProperty; 166 | ping->class.setProperty = setProperty; 167 | 168 | return true; 169 | } 170 | 171 | bool 172 | init_module_ping6() 173 | { 174 | DEBUG_STR("ping6->init()"); 175 | ping6 = (module *)shell->init_module("ping6"); 176 | ping6->destroy = destroy_ping6; 177 | ping6->class = modules->class; 178 | ping6->class.allocate = allocate_ping6; 179 | ping6->class.invoke = invokeMethod; 180 | ping6->class.hasProperty = hasProperty; 181 | ping6->class.getProperty = getProperty; 182 | ping6->class.setProperty = setProperty; 183 | 184 | return true; 185 | } 186 | -------------------------------------------------------------------------------- /extension/js/console.js: -------------------------------------------------------------------------------- 1 | /* Check CoNetServ object */ 2 | if(!Conetserv) var Conetserv = {}; 3 | 4 | /* 5 | * function for creating console objects, which are used for output of program 6 | * 7 | */ 8 | Conetserv.Console = function(div) { 9 | this.div = document.getElementById(div); //pointer to div which object takes care of 10 | this.code = ""; //container for data to be shown in element 11 | this.err = ""; //error data show in the top of console 12 | 13 | this.prevData = ""; //used for making sure whole line is being written 14 | this.direction = 0; //direction of output 0 = downwards 1 = upwards 15 | this.rows = []; //variable for storing rows of code 16 | this.rowCount = 0; //defines count of rows 17 | this.maxRows = 0; //maximum count of rows 18 | this.percent = 0; 19 | 20 | /* regular expressions */ 21 | this.linux = new Object(); 22 | this.linux.hostname = /([\w\-]+\.)+([a-z]+)/ig //\(([0-9\i]*)\).*/i 23 | this.linux.ip = /(\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})/ig 24 | this.linux.time = /(?:\/?(\d+\.?\d*))+\s?ms(ec){0,1}/ig // format: xx.yy/zz.yy ms 25 | 26 | /* for inputTimerErr */ 27 | this.touched = true; 28 | this.timedErr = false; 29 | this.timer = false; 30 | 31 | 32 | //gets color from string containing number at the begining 33 | //0% green 50% yellow 100% red 34 | //returns final html element 35 | this.getColor = function(input){ 36 | var color; 37 | // 0.2 = 100(percent)/500(maxvalue) 38 | var numberR = /\d+\.?\d*/g; 39 | var result = input.match(numberR); 40 | var finished = []; 41 | 42 | for (var key in result) { 43 | var nb = result[key]; 44 | 45 | var percent = parseFloat(nb)*0.2; 46 | if (percent <= 50) { 47 | color = parseInt(percent/50*196); 48 | 49 | color = (color<16.0 ? "#0" : "#") + (color).toString(16) + "B000"; 50 | } 51 | else if(percent<100) 52 | color = "#B0" + (parseInt(196-(percent-50)/50*196)).toString(16) + "00"; 53 | else 54 | color = "#B00000"; 55 | 56 | if(!finished[nb]) { 57 | input = input.replace(nb, '' + nb + ''); 58 | finished[nb] = true; 59 | } 60 | } 61 | return input; 62 | } 63 | 64 | //sets div for output - accepts name of div 65 | this.setDiv = function(div){ 66 | this.div = document.getElementById(div); 67 | } 68 | 69 | //adds text to console, automaticaly stylizes for ping, traceroute, etc 70 | this.add = function(text){ 71 | /* set touched to true and clear timed error if present */ 72 | this.touched = true; 73 | if(this.timedErr) { 74 | this.clearErr(); 75 | } 76 | 77 | this.prevData += text; 78 | var npos = 0; 79 | this.prevData = this.prevData.replace(/(\r?\n)+/gi, "\n"); 80 | 81 | while((npos = this.prevData.indexOf("\n")) != -1 ) { 82 | this.rowCount++; 83 | var row = this.colourLine(this.prevData.substr(0, npos+1)); 84 | 85 | /* In case of first line being only \n skip it */ 86 | if(this.rowCount == 1 && row == "
    "){ 87 | this.rowCount--; 88 | this.prevData = (this.prevData.substr(npos+1)); 89 | continue; 90 | } 91 | 92 | if(this.direction) { //writing to the begining of container 93 | this.rows.unshift(row); 94 | if(this.maxRows && this.rowCount > this.maxRows) { 95 | this.rows.pop(); 96 | } 97 | } else { //writing to the end of container 98 | this.rows.push(row); 99 | if(this.maxRows && this.rowCount > this.maxRows) { 100 | this.rows.shift(); 101 | } 102 | } 103 | 104 | this.code = this.rows.join(""); 105 | /* store remaining data */ 106 | this.prevData = (this.prevData.substr(npos+1)); 107 | } 108 | 109 | /* 110 | var tmp = document.createTextNode(this.code); 111 | this.div.appendChild(tmp); 112 | return; 113 | */ 114 | 115 | this.repaint(); 116 | } 117 | 118 | // sets error in the console 119 | this.setErr = function(text) { 120 | if(!(typeof(text) == "string")) 121 | return; 122 | var errText = text.replace(/((\r)*\n)+/g,"
    "); 123 | this.err = '
    \ 124 |

    '+errText+'

    '; 125 | 126 | this.repaint(); 127 | } 128 | 129 | this.clearErr = function() { 130 | this.err = ""; 131 | this.repaint(); 132 | } 133 | 134 | //colours all items in line 135 | this.colourLine = function(line) { 136 | var coloured = line.replace(/((\r)*\n)+/g,"
    "); 137 | 138 | coloured = coloured.replace(this.linux.hostname,"$&"); 139 | coloured = coloured.replace(this.linux.ip,"$1"); 140 | coloured = coloured.replace(this.linux.time, this.getColor); 141 | 142 | return coloured; 143 | } 144 | 145 | //clears console 146 | this.clear = function(){ 147 | /* clear timer of inputTimerErr */ 148 | clearTimeout(this.timer); 149 | 150 | this.err = ""; 151 | this.code = ""; 152 | this.prevData = ""; 153 | this.rows = []; 154 | this.rowCount = 0; 155 | this.repaint(); 156 | } 157 | 158 | //repaints whole console 159 | this.repaint = function(){ 160 | if(this.div) 161 | this.div.innerHTML = this.err + this.code; 162 | } 163 | 164 | /* 165 | * Checks if any input is written inside, otherwise sets error 166 | * Object must be same as parameter object 167 | * @param object defines which console will be setErr run in 168 | * @param time seconds after which error message is written inside 169 | * @param msg error message to be written inside 170 | */ 171 | this.inputTimerErr = function(object, time, msg) { 172 | this.touched = 0; 173 | this.timer = setTimeout(object + '._inputTimerSetErr("' + msg + '")', time * 1000); 174 | }, 175 | 176 | /* 177 | * Private function to be called by inputTimerErr, which checks if 178 | * console has been changed since start of timer 179 | * @param msg msg to be shown in console 180 | */ 181 | this._inputTimerSetErr = function(msg) { 182 | if(!this.touched) { 183 | this.setErr(msg); 184 | this.timedErr = true; 185 | } 186 | } 187 | 188 | 189 | } 190 | -------------------------------------------------------------------------------- /extension/js/localinfo.js: -------------------------------------------------------------------------------- 1 | /* Check CoNetServ object */ 2 | if(!Conetserv) var Conetserv = {}; 3 | 4 | /* External info object */ 5 | Conetserv.LocalInfo = { 6 | enabled : true, 7 | running : 0, 8 | 9 | initialize : function() { 10 | if(!this.enabled) 11 | return; 12 | 13 | this.Ipconfig.console = new Conetserv.Console("local-ipconfig-console"); 14 | this.Nmap.console = new Conetserv.Console("local-neighbours-console"); 15 | this.Route.console = new Conetserv.Console("local-route-console"); 16 | }, 17 | 18 | start : function() { 19 | if(!this.enabled || this.running) 20 | return false; 21 | 22 | this.startService(this.Ipconfig); 23 | this.startService(this.Nmap); 24 | this.startService(this.Route) 25 | 26 | return true; 27 | }, 28 | 29 | stop : function() { 30 | if(!this.enabled || this.running) 31 | return false; 32 | 33 | this.stopService(this.Ipconfig); 34 | this.stopService(this.Nmap); 35 | this.stopService(this.Route); 36 | 37 | return true 38 | }, 39 | 40 | startService : function(service) { 41 | if (service.enabled && service.interval == -1) { 42 | Conetserv.LocalInfo.running++; 43 | 44 | 45 | service.before_begin(); 46 | service.finished = false; 47 | 48 | service.console.clear(); 49 | 50 | service.console.inputTimerErr(service.object + ".console", 3, "Service has not returned any output yet. "); 51 | 52 | try { 53 | // Create function from service details and evaluate it 54 | if (eval("service.process = Conetserv.plugin." + service.identifier + ".start()")) { 55 | service.interval = window.setInterval(this.readService, 500, service); 56 | Conetserv.Ui.addIcons(".local", service.cls, '', '', 'ui-icon-clock'); 57 | this.readService(service); 58 | } else { 59 | service.interval = -1; 60 | } 61 | } catch(e) { 62 | service.console.setErr(e); 63 | service.interval = -1; 64 | } 65 | 66 | return true; 67 | } 68 | else { 69 | return false; 70 | } 71 | }, 72 | 73 | readService : function(service) { 74 | if (!service.enabled) { 75 | return false; 76 | } 77 | 78 | var received; 79 | try { 80 | received = service.process.read(); 81 | } catch(e) { 82 | service.console.setErr(e); 83 | } 84 | 85 | if (typeof(received) == 'string') { 86 | service.console.add(received); 87 | service.after_read(received); 88 | } else { 89 | if (!service.process.running) { 90 | if(service.console.rowCount <= 2) { 91 | var err = service.console.code; 92 | service.console.clear(); 93 | service.console.setErr("Service has most probably encountered an error with following output:

    " 94 | + err); 95 | } 96 | service.finished = true; 97 | Conetserv.LocalInfo.stopService(service); 98 | } 99 | } 100 | 101 | return true; 102 | }, 103 | 104 | stopService : function(service) { 105 | if (service.enabled && service.interval != -1) { 106 | 107 | try { 108 | delete service.process; 109 | } 110 | catch(e) { 111 | service.console.setErr(e); 112 | } 113 | 114 | Conetserv.Ui.removeIcons(".local", service.cls); 115 | 116 | service.console.touched = true; 117 | /* if service has been stopped manually, set error to console */ 118 | if(!service.finished) { 119 | service.console.setErr("Service has been terminated before its finish."); 120 | } 121 | 122 | window.clearInterval(service.interval); 123 | service.interval = -1; 124 | if(--Conetserv.LocalServices.running == 0) 125 | { 126 | } 127 | 128 | return true; 129 | } 130 | return false; 131 | } 132 | } 133 | 134 | Conetserv.LocalInfo.Ipconfig = { 135 | enabled: true, //defines, if service will be started 136 | interval: -1, //reading loop interval 137 | finished: false, //saying, if service has finished its run 138 | console: false, //text console 139 | process: false, //running process to read data from 140 | cls: '.ipconfig', //class for icons 141 | object: 'Conetserv.LocalInfo.Ipconfig', //object name 142 | identifier: 'ipconfig', //name for calling npapi functions 143 | argument:'', //parameter to be passed to npapi functions 144 | 145 | before_begin: function() { //extra commands to be executed before service is started 146 | 147 | }, 148 | 149 | after_read: function(received) { 150 | 151 | } 152 | } 153 | 154 | Conetserv.LocalInfo.Nmap = { 155 | enabled: true, //defines, if service will be started 156 | interval: -1, //reading loop interval 157 | finished: false, //saying, if service has finished its run 158 | console: false, //text console 159 | process: false, //running process to read data from 160 | cls: '.neighbours', //class for icons 161 | object: 'Conetserv.LocalInfo.Nmap', //object name 162 | identifier: 'nmap', //name for calling npapi functions 163 | argument:'192.168.1.0-255', //parameter to be passed to npapi functions 164 | 165 | before_begin: function() { //extra commands to be executed before service is started 166 | Conetserv.plugin.nmap.query = 1; 167 | }, 168 | 169 | after_read: function(received) { 170 | 171 | } 172 | } 173 | 174 | Conetserv.LocalInfo.Route = { 175 | enabled: true, //defines, if service will be started 176 | interval: -1, //reading loop interval 177 | finished: false, //saying, if service has finished its run 178 | console: false, //text console 179 | process: false, //running process to read data from 180 | cls: '.route', //class for icons 181 | object: 'Conetserv.LocalInfo.Route', //object name 182 | identifier: 'route', //name for calling npapi functions 183 | argument:'', //parameter to be passed to npapi functions 184 | 185 | before_begin: function() { //extra commands to be executed before service is started 186 | }, 187 | 188 | after_read: function(received) { 189 | 190 | } 191 | } 192 | 193 | -------------------------------------------------------------------------------- /CHANGELOG.txt: -------------------------------------------------------------------------------- 1 | Version 2.1 (2010-09-21) 2 | ======================== 3 | Browser support: 4 | * Mozilla Firefox 3.0+ add-on 5 | * Google Chrome 4.0+ extension 6 | * Opera 10.5+ widget (testing) 7 | * Safari extension (testing) 8 | Operating systems [arch] support: 9 | * Microsoft Windows [x86, x86_64] 10 | * GNU/Linux [x86, x86_64] 11 | * MacOSX [x86] 12 | Project: 13 | * CMake support for MacOSX (Darwin platform) 14 | * README: crxmake.py install how-to 15 | Plugin: 16 | * Add ROUTE command (Unix) 17 | * Fix NMAP for IPv6 18 | * Fix build issues on Darwin with XUL Runner SDK 19 | * Fix plugin initialization on MacOSX platform 20 | * Fix plugin initialization in Opera 21 | * Fix PING arguments on MacOSX (non-unix parameters) 22 | Extension: 23 | * Update to jQuery UI 1.8.4 24 | * Improve fonts and whitespaces in console outputs 25 | * Add hover closing red icon 26 | * Fix PING plotting parser for ping6 on MacOSX 27 | * Fix plot parsers for all Unix platforms 28 | * Tune MaxMind GeoIP parser (parse geoip.js) 29 | * Add Free IP geolocation webservice parser 30 | * Add IP Info DB parser 31 | * Add 2 Privacy.com parser 32 | * Fix & simplify IPinfo Security Portal parser 33 | * Fix MojeIP.cz parser (hostname, IPv6) 34 | 35 | 36 | Version 2.0 (2010-08-31) 37 | ======================== 38 | Browser support: 39 | * Mozilla Firefox 3.0+ add-on 40 | * Google Chrome 4.0+ extension 41 | Operating systems [arch] support: 42 | * Microsoft Windows [x86, x86_64] 43 | * GNU/Linux [x86, x86_64] 44 | Plugin: 45 | * CMake - automatic recognition of NPAPI NPString members (CamelCase or lowercase) 46 | * Added Dig and Nmap services 47 | * Added Nslookup AAAA record support 48 | * Commands now accepts options passed from JavaScript 49 | * Ping(6) - packet count, timeout, packet size and TTL options 50 | * Tracert(6)/Traceroute(6) - max. of hops, wait time, IP-to-hostname translation options 51 | * Nslookup - query option (A, AAAA records) 52 | * Nmap - query option (scan ports of a host, scan neighboars in local network) 53 | Extension: 54 | * Ping and Traceroute from looking glass servers 55 | * User friendly messages, errors and dialogs 56 | * Showing message if no service output has been received for few seconds 57 | * Checking presence of local services, eventually showing the message with installation steps 58 | * Local and external services can be all stopped by one click 59 | * Local and external services can be run by hitting enter in url-bar 60 | * JavaScript objects are now encapsulated in Conetserv object (namespace) 61 | * Options: Selectable looking glass servers/providers 62 | * Options: Added settings for ping - packet count, wait time, packet size, TTL 63 | * Options: Added settings for traceroute - max hops, wait time, IP-to-hostname translation 64 | * Options: Ping console can be limited/unlimited 65 | * Options: Setting number of values in ping plot 66 | * Service parser for MaxMind GeoIP, another source for interactive location map 67 | * Fixed lots of small bugs 68 | 69 | 70 | 71 | Version 1.3 (2010-06-12) 72 | ======================== 73 | Browser support: 74 | * Mozilla Firefox 3.0+ add-on 75 | * Google Chrome 4.0+ extension 76 | * Opera 10.5+ widget 77 | Operating systems [arch] support: 78 | * Microsoft Windows [x86, x86_64] 79 | * GNU/Linux [x86, x86_64] 80 | * MacOSX Darwin [x86] (until version 1.3.3) 81 | Project: 82 | * Switch project build system to CMake 83 | * Auto-generation of project files/variables, eg. shared libraries, manifest 84 | files etc. 85 | * Automatic generation of browser-specific packages 86 | (Firefox Add-on, Chrome Extension and Opera Widget) 87 | Plugin: 88 | * Auto-generation of project files using CMake (Linux and Windows compatible) 89 | * Significant clean-up in directory structure and platform-dependent files 90 | Extension: 91 | * Redesign - divide layout into local services and external info 92 | (get ready for more features, eg. external services and local info) 93 | * New set of icons (by Rafal Ramatowski) 94 | * Add settings tab (based on LocalStorage) 95 | * Possibility to autorun services on startup 96 | * Selectable extension tab as front-page 97 | * Selectable jQuery themes in settings (Cupertino, South Street and Sunny) 98 | * Rewrite plot.js and other files into OOP 99 | * Fix long output in service consoles 100 | * Rewrite lost packet analysis into regexp 101 | * Improve visibility of console time values 102 | * Fix IPv6 address inside the http protocol 103 | * Automatic toolbar icon in Firefox 104 | * "Google.com - JSAPI" parser (countryCode, country, city, region, 105 | latitude, longitude) 106 | * Asynchronous Google Map with location markers 107 | Bugfixes: 108 | * Version 1.3.6 (2010-08-09) 109 | - Options save on-the-fly 110 | - Fix locale issues on Windows 111 | - Fix domain parser for WHOIS command to support all national TLDs (*.co.uk, *.com.tr etc.) 112 | * Version 1.3.5 (2010-07-19) 113 | - Switch to UNICODE output on Windows 114 | - Improve parsers of ping output 115 | - Fix Linux32 plugin 116 | * Version 1.3.4 (2010-07-17) 117 | - Fix ping plotting bug on Linux 118 | - Add "-n" argument to ping on Linux 119 | - Fix Win32 and Win64 plugin 120 | * Version 1.3.3 (2010-06-28) 121 | - Plugin: Fix IPv6 colons as valid command argument 122 | - Remove MacOS X bundle and thus Darwin compatibility 123 | (wait for build machine and CMake build system compatibility) 124 | * Version 1.3.2 (2010-06-23) 125 | - Add missing theme images in packages 126 | * Version 1.3.1 (2010-06-20) 127 | - Package clean-up 128 | - Fix Win64 plugin 129 | 130 | 131 | Version 1.2 (2010-03-31) 132 | ======================== 133 | Browser support: 134 | * Mozilla Firefox 2.0+ add-on 135 | * Google Chrome 1.0+ extension 136 | * Opera 9.0+ widget 137 | Operating systems [arch] support: 138 | * Microsoft Windows [x86_64] 139 | * GNU/Linux [x86, x86_64] 140 | * MacOSX Darwin [x86] 141 | Plugin: 142 | * Remove Punycode support and LIB IDN stuff 143 | * URL parser (valid ASCII characters) 144 | Extension: 145 | * URL validator & parser (Punycode support) 146 | * Services parser (data from remote servers) 147 | * Host info tab with data from new parsers: 148 | * "WIPmania.com - WorldIP API" parser (externIpv4, countryCode, country, 149 | city, region, latitude, longitude) 150 | * "CGI script by Chris F.A. Johnson" parser (externIpv4) 151 | * "Check IP by DynDNS.com" parser (externIpv4) 152 | * "MojeIP.cz" parser (externIpv4, hostname) 153 | * "IPinfo Security Portal" parser (externIpv4, hostname) 154 | * "RADb (Merit Network Inc.)" parser (route, provider) 155 | * Google map (init latitude and longitude) 156 | 157 | 158 | Version 1.1 (2010-03-14) 159 | ======================== 160 | Project: 161 | * Automated generation of browser-specific packages (Firefox, Chrome, Opera) 162 | Browser support: 163 | * Mozilla Firefox 2.0+ add-on 164 | * Google Chrome 1.0+ extension 165 | * Opera 9.0+ widget 166 | Operating systems [arch] support: 167 | * Microsoft Windows [x86_64] 168 | * GNU/Linux [x86, x86_64] 169 | * MacOSX Darwin [x86] 170 | Plugin: 171 | * Punycode support .. UTF-8 (sub-)domains 172 | * NSLOOKUP command 173 | Extension: 174 | * PING(6) plot: min, max and avg values 175 | * Initiate domain string in Firefox&Chrome 176 | 177 | 178 | Version 1.0 (2010-02-28) 179 | ======================== 180 | Browser support: 181 | * Mozilla Firefox 2.0+ add-on 182 | * Google Chrome 1.0+ extension 183 | * Opera 9.0+ widget 184 | Operating systems [arch] support: 185 | * Microsoft Windows [x86] 186 | * GNU/Linux [x86, x86_64] 187 | Documentation: 188 | * Use Doxygen as the source code documentation generator tool 189 | Plugin: 190 | * PING command (IPv4) 191 | * PING6 command (IPv6) 192 | * TRACEROUTE command (IPv4) 193 | * TRACEROUTE6 command (IPv6) 194 | * WHOIS command 195 | Extension: 196 | * Console output of plugin tools 197 | * PING(6) simple plot 198 | * TRACEROUTE(6) plot 199 | -------------------------------------------------------------------------------- /extension/css/ui.css: -------------------------------------------------------------------------------- 1 | /* 2 | Document : ui 3 | Created on : 29.5.2010 4 | Author : kanei 5 | Description: 6 | Purpose of the stylesheet follows. 7 | */ 8 | 9 | body { 10 | font-size: 62.5%; 11 | overflow: hidden; 12 | } 13 | 14 | #tabs { 15 | width: 680px; 16 | height: 560px; 17 | overflow: hidden; 18 | } 19 | 20 | #about-tab-header { 21 | float: right; 22 | } 23 | 24 | #settings-tab-header { 25 | float: right; 26 | } 27 | 28 | .content { 29 | display: none; 30 | height: 300px; 31 | } 32 | 33 | .url-input { 34 | padding: 0.4em 1em; 35 | margin: 0px -1px 10px 0px; 36 | line-height: 1.4; 37 | } 38 | 39 | .url-start { 40 | margin-bottom: 10px; 41 | margin-left: -2px; 42 | } 43 | 44 | .radio-tab-label.ui-button-text-icon .ui-button-text{ 45 | padding: 0.4em 2em 0.4em 1em; 46 | } 47 | 48 | 49 | .ui-icon-clock, 50 | .ui-icon-circle-close, 51 | .ui-icon-close { 52 | position: absolute; 53 | right: 3px; 54 | } 55 | 56 | .ui-icon:hover { 57 | background-image: url(images/ui-icons_red_256x240.png); 58 | } 59 | 60 | .console { 61 | width: 640px; 62 | height: 420px; 63 | margin-bottom: 5px; 64 | padding: 3px 5px; 65 | color: #444; 66 | overflow: auto; 67 | background: #f8f9fa; 68 | } 69 | 70 | .service-label { 71 | height: 15px; 72 | font-weight: bold; 73 | margin-bottom: -5px; 74 | } 75 | 76 | .ping .console, 77 | .ping6 .console, 78 | .tracert .console, 79 | .tracert6 .console { 80 | height: 200px; 81 | } 82 | 83 | .ping .console.third, 84 | .ping6 .console.third { 85 | height: 120px; 86 | } 87 | 88 | .nslookup .console.half, 89 | .tracert .console.half, 90 | .tracert6 .console.half { 91 | height: 190px; 92 | } 93 | 94 | .nslookup h4 { 95 | margin: 0px; 96 | padding: 0px; 97 | } 98 | 99 | .plot-placeholder { 100 | margin-top: 10px; 101 | height:220px; 102 | width: 640px; 103 | } 104 | 105 | #map-conteiner { 106 | height: 450px; 107 | width: 640px; 108 | padding: 5px; 109 | } 110 | 111 | #map-placeholder { 112 | height: 450px; 113 | width: 640px; 114 | } 115 | /* Lost packet banner on ping plot */ 116 | div.lostPacketsLabelLight { 117 | position:absolute; 118 | left: 530px; 119 | top: 20px; 120 | color: #E33; 121 | font-size: smaller; 122 | opacity: 0.5; 123 | background-color: white; 124 | padding: 3px; 125 | border: 1px solid #E33; 126 | } 127 | 128 | div.lostPacketsLabel{ 129 | position: absolute; 130 | left: 530px; 131 | top: 20px; 132 | color: #E33; 133 | font-size: smaller; 134 | padding: 3px; 135 | border: 1px solid #E33; 136 | } 137 | 138 | .zoomin{ 139 | position: absolute; 140 | left: 580px; 141 | top: 20px; 142 | } 143 | 144 | .zoomout{ 145 | position: absolute; 146 | left: 600px; 147 | top: 20px; 148 | } 149 | 150 | /* plot labels styling */ 151 | .valueLabels { 152 | font-size:80%; 153 | color:black; 154 | } 155 | div.valueLabelLight { 156 | opacity:0.5; 157 | background-color: white; 158 | border:none; 159 | position:absolute; 160 | } 161 | div.valueLabel { 162 | position:absolute; 163 | border:none; 164 | } 165 | 166 | /************************************************************************** 167 | * console.js 168 | **************************************************************************/ 169 | 170 | /* First icon on service radio button*/ 171 | .service-state { 172 | display: none; 173 | } 174 | 175 | .colorbar { 176 | display: inline; 177 | margin: 0 5px; 178 | border: 1px solid white; 179 | height: 1em; 180 | width: 1em; 181 | } 182 | 183 | .colorbar span { 184 | visibility: hidden; 185 | } 186 | 187 | /* plugin loader */ 188 | #plugin-placeholder { 189 | width: 0px; 190 | height: 0px; 191 | } 192 | 193 | #plugin-placeholder object { 194 | width: 0px; 195 | height: 0px; 196 | } 197 | 198 | .console .ui-state-highlight { 199 | font-family: 'Lucida Grande', 'Lucida Sans', Arial, sans-serif; 200 | padding-left: 10px; 201 | margin: 5px; 202 | } 203 | 204 | .console .ui-state-highlight p { 205 | margin-top: 0px; 206 | } 207 | 208 | pre.console { 209 | font-family: "Courier New", "Monospace", monospace; 210 | } 211 | /************************************************************************** 212 | * settings tab 213 | **************************************************************************/ 214 | span.hint { 215 | display: block; 216 | clear: left; 217 | font-size: 9px; 218 | color: gray; 219 | margin-left: 10px; 220 | } 221 | 222 | #settings-general-frontpage { 223 | height: 150px; 224 | width: 200px; 225 | float: left; 226 | margin: 0 10px 10px 0; 227 | padding: 10px; 228 | } 229 | 230 | #settings-general-frontpage-children { 231 | height: 150px; 232 | width: 200px; 233 | margin: 0 10px 10px 0; 234 | padding: 10px; 235 | float: left; 236 | } 237 | 238 | #settings-general-toolbox-div { 239 | clear: left; 240 | } 241 | 242 | #settings-general-div input.single-line{ 243 | clear: left; 244 | } 245 | 246 | #settings-local-services-div input.single-line{ 247 | clear: left; 248 | } 249 | 250 | #settings-general-div h4{ 251 | clear:left; 252 | } 253 | 254 | #settings-general-skin{ 255 | height: 70px; 256 | width: 200px; 257 | margin: 0 10px 10px 0; 258 | padding: 10px; 259 | clear: left; 260 | } 261 | 262 | #settings-local-services-div h4 { 263 | padding: 0px; 264 | margin: 0 10px 0 0; 265 | } 266 | 267 | #settings-local-services-div input { 268 | margin: 10px 10px 0 0; 269 | } 270 | 271 | #settings-local-services-div .ui-widget { 272 | width: 250px; 273 | float: left; 274 | padding: 0px 10px 10px 10px; 275 | margin: 0px 15px 15px 0px; 276 | } 277 | 278 | #settings-local-info-div .ui-widget, 279 | #settings-external-services-div .ui-widget { 280 | padding: 0px 10px 10px 10px; 281 | } 282 | 283 | #settings-local-info-div .center 284 | #settings-external-services-div .center { 285 | text-align: center; 286 | } 287 | 288 | settings-general-toolbox-div { 289 | display: none; 290 | } 291 | 292 | /************************************************************************** 293 | * external-info tab 294 | **************************************************************************/ 295 | #external-provider-div div { 296 | height: 130px; 297 | width: 290px; 298 | margin: 5px 10px 5px 0; 299 | padding: 5px; 300 | float: left; 301 | } 302 | 303 | #external-provider-div h4 { 304 | margin: 0px; 305 | } 306 | 307 | #external-provider-div ul { 308 | list-style-type: none; 309 | padding: 0px; 310 | } 311 | 312 | #external-provider-div ul li { 313 | margin-left: 5px; 314 | } 315 | 316 | #external-provider-div div#external-provider-location-div{ 317 | height: 280px; 318 | } 319 | 320 | /************************************************************************** 321 | * about tab 322 | **************************************************************************/ 323 | 324 | #aboutTab { 325 | height: 480px; 326 | font-size: 12px; 327 | } 328 | 329 | #aboutTab .column { 330 | width: 320px; 331 | float: left; 332 | } 333 | 334 | #aboutTab .block { 335 | margin: 0 10px 10px 0; 336 | padding: 5px; 337 | } 338 | 339 | #aboutTab h2 { 340 | font-size: 24px; 341 | margin-top: 5px; 342 | margin-bottom: 5px; 343 | } 344 | 345 | #aboutTab h3 { 346 | margin: 0px; 347 | font-size: 12px; 348 | margin-bottom: 0px; 349 | } 350 | 351 | #aboutTab ul { 352 | list-style-type: none; 353 | padding-left: 10px; 354 | padding-left: 20px; 355 | } 356 | 357 | #aboutTab li { 358 | margin: 0; 359 | } 360 | 361 | #aboutTab p { 362 | margin-left: 10px; 363 | } 364 | 365 | #aboutTab .slogan { 366 | font-weight: bold; 367 | font-size: 16px; 368 | } 369 | 370 | #about-logo { 371 | background: url("../images/icon128.png") no-repeat; 372 | height: 128px; 373 | width: 128px; 374 | position: absolute; 375 | right: 20px; 376 | bottom: 20px; 377 | z-index: auto; 378 | } 379 | 380 | pre { 381 | font-family: 'Lucida Grande', 'Lucida Sans', Arial, sans-serif; 382 | font-size: 11px; 383 | } -------------------------------------------------------------------------------- /plugin/plugin.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | #include "config.h" 6 | #include "debug.h" 7 | #include "identifier.h" 8 | #include "init_modules.h" 9 | #include "npapi.h" 10 | #include "plugin.h" 11 | #include "module.h" 12 | 13 | static bool 14 | hasMethod(NPObject *obj, NPIdentifier identifier) 15 | { 16 | DEBUG_STR("plugin->hasMethod(%s): false", DEBUG_IDENTIFIER(identifier)); 17 | return false; 18 | } 19 | 20 | static bool 21 | invokeMethod(NPObject *obj, NPIdentifier identifier, const NPVariant *args, uint32_t argc, NPVariant *result) 22 | { 23 | DEBUG_STR("plugin->invokeMethod(): false"); 24 | return false; 25 | } 26 | 27 | static bool 28 | invokeDefault(NPObject *obj, const NPVariant *args, const uint32_t argCount, NPVariant *result) 29 | { 30 | DEBUG_STR("plugin->invokeDefault(): false"); 31 | return false; 32 | } 33 | 34 | static bool 35 | hasProperty(NPObject *obj, NPIdentifier identifier) 36 | { 37 | /* Plugin version */ 38 | if (identifier == identifiers->version) { 39 | DEBUG_STR("plugin->hasProperty(%s): true", DEBUG_IDENTIFIER(identifier)); 40 | return true; 41 | } 42 | 43 | /* Plugin modules */ 44 | #ifdef MODULE_PING 45 | if (identifier == identifiers->ping) { 46 | DEBUG_STR("plugin->hasProperty(%s): true", DEBUG_IDENTIFIER(identifier)); 47 | return true; 48 | } 49 | #endif 50 | 51 | #ifdef MODULE_PING6 52 | if (identifier == identifiers->ping6) { 53 | DEBUG_STR("plugin->hasProperty(%s): true", DEBUG_IDENTIFIER(identifier)); 54 | return true; 55 | } 56 | #endif 57 | 58 | #ifdef MODULE_TRACEROUTE 59 | if (identifier == identifiers->traceroute || identifier == identifiers->tracert) { 60 | DEBUG_STR("plugin->hasProperty(%s): true", DEBUG_IDENTIFIER(identifier)); 61 | return true; 62 | } 63 | #endif 64 | 65 | #ifdef MODULE_TRACEROUTE6 66 | if (identifier == identifiers->traceroute6 || identifier == identifiers->tracert6) { 67 | DEBUG_STR("plugin->hasProperty(%s): true", DEBUG_IDENTIFIER(identifier)); 68 | return true; 69 | } 70 | #endif 71 | 72 | #ifdef MODULE_NSLOOKUP 73 | if (identifier == identifiers->nslookup) { 74 | DEBUG_STR("plugin->hasProperty(%s): true", DEBUG_IDENTIFIER(identifier)); 75 | return true; 76 | } 77 | #endif 78 | 79 | #ifdef MODULE_WHOIS 80 | if (identifier == identifiers->whois) { 81 | DEBUG_STR("plugin->hasProperty(%s): true", DEBUG_IDENTIFIER(identifier)); 82 | return true; 83 | } 84 | #endif 85 | 86 | #ifdef MODULE_DIG 87 | if (identifier == identifiers->dig) { 88 | DEBUG_STR("plugin->hasProperty(%s): true", DEBUG_IDENTIFIER(identifier)); 89 | return true; 90 | } 91 | #endif 92 | 93 | #ifdef MODULE_NMAP 94 | if (identifier == identifiers->nmap) { 95 | DEBUG_STR("plugin->hasProperty(%s): true", DEBUG_IDENTIFIER(identifier)); 96 | return true; 97 | } 98 | #endif 99 | 100 | #ifdef MODULE_IPCONFIG 101 | if (identifier == identifiers->ipconfig || identifier == identifiers->ifconfig) { 102 | DEBUG_STR("plugin->hasProperty(%s): true", DEBUG_IDENTIFIER(identifier)); 103 | return true; 104 | } 105 | #endif 106 | 107 | DEBUG_STR("plugin->hasProperty(%s): false", DEBUG_IDENTIFIER(identifier)); 108 | return false; 109 | } 110 | 111 | static bool 112 | getProperty(NPObject *obj, NPIdentifier identifier, NPVariant *result) 113 | { 114 | int len; 115 | NPString str; 116 | NPUTF8 *version; 117 | 118 | /* Plugin version */ 119 | if (identifier == identifiers->version) { 120 | 121 | len = strlen(VERSION); 122 | version = browser->memalloc((len + 1) * sizeof(*version)); 123 | strcpy(version, VERSION); 124 | STRING_UTF8CHARACTERS(str) = version; 125 | STRING_UTF8LENGTH(str) = len; 126 | 127 | DEBUG_STR("plugin->getProperty(%s): %s", DEBUG_IDENTIFIER(identifier), version); 128 | 129 | 130 | /* msvc can't handle simple macro 131 | * STRINGN_TO_NPVARIANT(version, len, *result); 132 | */ 133 | 134 | result->type = NPVariantType_String; 135 | result->value.stringValue = str; 136 | 137 | return true; 138 | } 139 | 140 | /* Plugin modules */ 141 | #ifdef MODULE_PING 142 | if (identifier == identifiers->ping) { 143 | DEBUG_STR("plugin->getProperty(%s): true", DEBUG_IDENTIFIER(identifier)); 144 | OBJECT_TO_NPVARIANT(browser->createobject(((object *)obj)->instance, &(ping->class)), *result); 145 | return true; 146 | } 147 | #endif 148 | 149 | #ifdef MODULE_PING6 150 | if (identifier == identifiers->ping6) { 151 | DEBUG_STR("plugin->getProperty(%s): true", DEBUG_IDENTIFIER(identifier)); 152 | OBJECT_TO_NPVARIANT(browser->createobject(((object *)obj)->instance, &(ping6->class)), *result); 153 | return true; 154 | } 155 | #endif 156 | 157 | #ifdef MODULE_TRACEROUTE 158 | if (identifier == identifiers->traceroute || identifier == identifiers->tracert) { 159 | DEBUG_STR("plugin->getProperty(%s): true", DEBUG_IDENTIFIER(identifier)); 160 | OBJECT_TO_NPVARIANT(browser->createobject(((object *)obj)->instance, &(traceroute->class)), *result); 161 | return true; 162 | } 163 | #endif 164 | 165 | #ifdef MODULE_TRACEROUTE6 166 | if (identifier == identifiers->traceroute6 || identifier == identifiers->tracert6) { 167 | DEBUG_STR("plugin->getProperty(%s): true", DEBUG_IDENTIFIER(identifier)); 168 | OBJECT_TO_NPVARIANT(browser->createobject(((object *)obj)->instance, &(traceroute6->class)), *result); 169 | return true; 170 | } 171 | #endif 172 | 173 | #ifdef MODULE_NSLOOKUP 174 | if (identifier == identifiers->nslookup) { 175 | DEBUG_STR("plugin->getProperty(%s): true", DEBUG_IDENTIFIER(identifier)); 176 | OBJECT_TO_NPVARIANT(browser->createobject(((object *)obj)->instance, &(nslookup->class)), *result); 177 | return true; 178 | } 179 | #endif 180 | 181 | #ifdef MODULE_WHOIS 182 | if (identifier == identifiers->whois) { 183 | DEBUG_STR("plugin->getProperty(%s): true", DEBUG_IDENTIFIER(identifier)); 184 | OBJECT_TO_NPVARIANT(browser->createobject(((object *)obj)->instance, &(whois->class)), *result); 185 | return true; 186 | } 187 | #endif 188 | 189 | #ifdef MODULE_DIG 190 | if (identifier == identifiers->dig) { 191 | DEBUG_STR("plugin->getProperty(%s): true", DEBUG_IDENTIFIER(identifier)); 192 | OBJECT_TO_NPVARIANT(browser->createobject(((object *)obj)->instance, &(dig->class)), *result); 193 | return true; 194 | } 195 | #endif 196 | 197 | #ifdef MODULE_NMAP 198 | if (identifier == identifiers->nmap) { 199 | DEBUG_STR("plugin->getProperty(%s): true", DEBUG_IDENTIFIER(identifier)); 200 | OBJECT_TO_NPVARIANT(browser->createobject(((object *)obj)->instance, &(nmap->class)), *result); 201 | return true; 202 | } 203 | #endif 204 | 205 | #ifdef MODULE_IPCONFIG 206 | if (identifier == identifiers->ipconfig || identifier == identifiers->ifconfig) { 207 | DEBUG_STR("plugin->getProperty(%s): true", DEBUG_IDENTIFIER(identifier)); 208 | OBJECT_TO_NPVARIANT(browser->createobject(((object *)obj)->instance, &(ipconfig->class)), *result); 209 | return true; 210 | } 211 | #endif 212 | 213 | DEBUG_STR("plugin->getProperty(%s): false", DEBUG_IDENTIFIER(identifier)); 214 | 215 | return false; 216 | } 217 | 218 | static NPObject * 219 | allocate(NPP instance, NPClass *class) 220 | { 221 | object *obj; 222 | 223 | DEBUG_STR("plugin->allocate()"); 224 | 225 | obj = browser->memalloc(sizeof(*obj)); 226 | obj->instance = instance; 227 | 228 | return (NPObject *)obj; 229 | } 230 | 231 | static void 232 | deallocate(NPObject *obj) 233 | { 234 | DEBUG_STR("plugin->deallocate()"); 235 | browser->memfree(obj); 236 | } 237 | 238 | NPClass pluginClass = { 239 | NP_CLASS_STRUCT_VERSION, 240 | allocate, 241 | deallocate, 242 | NULL/*invalidate*/, 243 | hasMethod, 244 | invokeMethod, 245 | invokeDefault, 246 | hasProperty, 247 | getProperty, 248 | NULL/*setProperty*/, 249 | NULL/*removeProperty*/, 250 | NULL/*enumerate*/, 251 | NULL/*construct*/ 252 | }; 253 | -------------------------------------------------------------------------------- /plugin/win/cmd_exe.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | 6 | #include "debug.h" 7 | #include "cmd_exe.h" 8 | #include "npapi.h" 9 | #include "module.h" 10 | 11 | /* FIXME: Move these magic definitions to special header file: */ 12 | #define DEBUGCON 0 13 | #define strcasecmp stricmp 14 | #define strncasecmp strnicmp 15 | 16 | /* Disable deprecation messages */ 17 | #define _CRT_SECURE_NO_WARNINGS 18 | #define LOCALEDIR "." 19 | 20 | #if _MSC_VER && !__cplusplus 21 | #define inline __inline 22 | #endif 23 | 24 | cmd_exe *cmd_line = NULL; /**< Command line abstraction */ 25 | char *buffer = NULL; /**< Buffer for pipe I/O */ 26 | char *buffer_wchar = NULL; /**< Buffer for wide chars */ 27 | char *buffer_utf8 = NULL; /**< Buffer for utf8 chars */ 28 | 29 | /** 30 | * Stop running process 31 | * 32 | * @param p Process to be stopped 33 | * @return True on success, false otherwise 34 | */ 35 | static bool 36 | process_stop(process *p) 37 | { 38 | /* return if the process is not running */ 39 | if (!p->running) { 40 | DEBUG_STR("process->stop(pid %d): false (not running)", p->pid); 41 | return false; 42 | } 43 | 44 | /* kill the process */ 45 | TerminateProcess(p->pid, 0); 46 | 47 | /* close read pipe */ 48 | CloseHandle(p->pipe[0]); 49 | p->running = false; 50 | 51 | DEBUG_STR("process->stop(pid %d): true", p->pid); 52 | 53 | return true; 54 | } 55 | 56 | /** 57 | * Read process output data 58 | * 59 | * @param p Process to read data from 60 | * @param result Result string on success, false otherwise 61 | * @return True on success, false otherwise 62 | */ 63 | static bool 64 | process_read(process *p, NPVariant *result) 65 | { 66 | DWORD len = 0, status; 67 | UINT codepage; 68 | NPString str; 69 | NPUTF8 *chars; 70 | 71 | /* return if the process is not running */ 72 | if (!p->running) { 73 | DEBUG_STR("cmd_line->read(): false (not running)"); 74 | BOOLEAN_TO_NPVARIANT(false, *result); 75 | return true; 76 | } 77 | 78 | /* peek - check if data are available */ 79 | if (!PeekNamedPipe(p->pipe[0], NULL, 0, NULL, &status, NULL)) { 80 | 81 | DEBUG_STR("cmd_line->read(): false (peek error %d)", GetLastError()); 82 | 83 | BOOLEAN_TO_NPVARIANT(false, *result); 84 | return true; 85 | 86 | } 87 | 88 | /* can't peek */ 89 | if (!status) { 90 | 91 | GetExitCodeProcess(p->pid, &status); 92 | if (status != STILL_ACTIVE) { 93 | 94 | DEBUG_STR("cmd_line->read(): false (process has finished) "); 95 | 96 | /* close read pipe */ 97 | CloseHandle(p->pipe[0]); 98 | p->running = false; 99 | 100 | } else { 101 | 102 | DEBUG_STR("cmd_line->read(): false (no data, continue)", GetLastError()); 103 | 104 | } 105 | 106 | BOOLEAN_TO_NPVARIANT(false, *result); 107 | return true; 108 | } 109 | 110 | /* read from pipe */ 111 | if (!ReadFile(p->pipe[0], buffer, BUFLEN - 1, &len, NULL)) { 112 | 113 | DEBUG_STR("cmd_line->read(): false (read error %d)", GetLastError()); 114 | 115 | BOOLEAN_TO_NPVARIANT(false, *result); 116 | return true; 117 | } 118 | 119 | if (len <= 0) { 120 | DEBUG_STR("cmd_line->read(): false (string len=0)", GetLastError()); 121 | 122 | BOOLEAN_TO_NPVARIANT(false, *result); 123 | return true; 124 | } 125 | 126 | /* get active codepage id */ 127 | codepage = GetOEMCP(); 128 | 129 | /* convert multibyte characters (of current codepage) to widechar characters */ 130 | len = MultiByteToWideChar(codepage, 0, buffer, len, buffer_wchar, BUFLEN_WCHAR); 131 | 132 | /* convert widechar characters to utf-8 */ 133 | len = WideCharToMultiByte(CP_UTF8, 0, buffer_wchar, len, buffer_utf8, BUFLEN_UTF8, 0, 0); 134 | 135 | /* be sure to terminate string by null-character */ 136 | buffer_utf8[len] = '\0'; 137 | 138 | /* allocate and fill the result string */ 139 | chars = browser->memalloc((len + 1) * sizeof(*chars)); 140 | memcpy(chars, buffer_utf8, len + 1); 141 | STRING_UTF8CHARACTERS(str) = chars; 142 | STRING_UTF8LENGTH(str) = len; 143 | 144 | result->type = NPVariantType_String; 145 | result->value.stringValue = str; 146 | 147 | DEBUG_STR("cmd_line->read(): string(len=%d)", len); 148 | 149 | return true; 150 | } 151 | 152 | /** 153 | * Run system command 154 | * 155 | * @param p Variable to store process data to 156 | * @param path Command name 157 | * @param argv String of arguments 158 | * @return True on success, false otherwise 159 | */ 160 | static bool 161 | run_command(process *p, const char *cmd) 162 | { 163 | SECURITY_ATTRIBUTES saAttr; 164 | PROCESS_INFORMATION procInfo; 165 | STARTUPINFO startInfo; 166 | BOOL success = FALSE; 167 | DWORD status; 168 | char *command; 169 | int len; 170 | 171 | /* return if the process is already running */ 172 | if (p->running) { 173 | DEBUG_STR("cmd_line->run(): false (process already running)"); 174 | return false; 175 | } 176 | 177 | /* Set the bInheritHandle flag so pipe handles are inherited. */ 178 | saAttr.nLength = sizeof(saAttr); 179 | saAttr.bInheritHandle = TRUE; 180 | saAttr.lpSecurityDescriptor = NULL; 181 | 182 | /* Create a pipe for the child process's STDOUT. */ 183 | if (!CreatePipe(&p->pipe[0], &p->pipe[1], &saAttr, 0)) { 184 | DEBUG_STR("cmd_line->run(): CreatePipe() - error"); 185 | browser->setexception(NULL, "cmd_line->run(): CreatePipe() - error"); 186 | return 0; 187 | } 188 | 189 | /* Ensure the read handle to the pipe for STDOUT is not inherited. */ 190 | if (!SetHandleInformation(p->pipe[0], HANDLE_FLAG_INHERIT, 0)) { 191 | DEBUG_STR("cmd_line->run(): SetHandleInformation() - error"); 192 | browser->setexception(NULL, "cmd_line->run(): SetHandleInformation() - error"); 193 | return 0; 194 | } 195 | 196 | /* Create a child process which uses stdout pipe */ 197 | 198 | /* Prepare structures and set stdout handles */ 199 | ZeroMemory(&procInfo, sizeof(procInfo)); 200 | ZeroMemory(&startInfo, sizeof(startInfo)); 201 | startInfo.cb = sizeof(startInfo); 202 | 203 | if (!DEBUGCON) { 204 | startInfo.wShowWindow = SW_HIDE; 205 | startInfo.dwFlags |= STARTF_USESHOWWINDOW; 206 | startInfo.hStdError = p->pipe[1]; 207 | startInfo.hStdOutput = p->pipe[1]; 208 | startInfo.dwFlags |= STARTF_USESTDHANDLES; 209 | } 210 | 211 | /* create command for execution */ 212 | len = strlen(cmd); 213 | command = browser->memalloc(sizeof(*command) * (len + 16/*len of bellow cmd*/ + 1)); 214 | sprintf(command, "cmd.exe /U /C \"%s\"", cmd); 215 | 216 | success = CreateProcess(NULL, 217 | command, // command line 218 | NULL, // process security attributes 219 | NULL, // primary thread security attributes 220 | TRUE, // handles are inherited 221 | 0, // creation flags 222 | NULL, // use parent's environment 223 | NULL, // current directory 224 | &startInfo, // STARTUPINFO pointer 225 | &procInfo // receives PROCESS_INFORMATION 226 | ); 227 | 228 | /* free executed command string */ 229 | browser->memfree(command); 230 | 231 | if (!success) { 232 | DEBUG_STR("cmd_line->run(): CreateProcess() - error"); 233 | browser->setexception(NULL, "cmd_line->run(): CreateProcess() - error"); 234 | return false; 235 | } 236 | 237 | /* store process handle and close process thread handle */ 238 | p->pid = procInfo.hProcess; 239 | p->running = true; 240 | 241 | DEBUG_STR("cmd_line->run(\"%s\"): PID %d", cmd, p->pid); 242 | 243 | CloseHandle(procInfo.hThread); 244 | return true; 245 | } 246 | 247 | /** 248 | * CMD_EXE_module destructor 249 | * 250 | * @param m CMD_EXE_module to be destroyed 251 | */ 252 | static void 253 | destroy_cmd_line_module(cmd_exe_module *m) 254 | { 255 | if (m) { 256 | browser->memfree(m); 257 | } 258 | } 259 | 260 | /** 261 | * CMD_EXE_module constructor 262 | * 263 | * @param program Command to be run 264 | * @return Initialized CMD_EXE_module on success, NULL otherwise 265 | */ 266 | cmd_exe_module * 267 | init_cmd_line_module(const char *program) 268 | { 269 | cmd_exe_module *m; 270 | 271 | /* allocate cmd_exe module */ 272 | m = browser->memalloc(sizeof(*m)); 273 | if (!m) 274 | return NULL; 275 | 276 | /* TODO: Try command in CMD.EXE */ 277 | m->found = true; 278 | 279 | return m; 280 | } 281 | 282 | /** 283 | * cmd_exe destructor 284 | * 285 | */ 286 | static void 287 | destroy_cmd_line() 288 | { 289 | DEBUG_STR("cmd_line->destroy()"); 290 | 291 | if (buffer != NULL) 292 | browser->memfree(buffer); 293 | 294 | if (buffer_wchar != NULL) 295 | browser->memfree(buffer_wchar); 296 | 297 | if (buffer_utf8 != NULL) 298 | browser->memfree(buffer_utf8); 299 | 300 | if (cmd_line != NULL) 301 | browser->memfree(cmd_line); 302 | } 303 | 304 | /** 305 | * CMD_EXE constructor 306 | * 307 | * @return True on success, false otherwise 308 | */ 309 | bool 310 | init_cmd_line() 311 | { 312 | DEBUG_STR("cmd_line->init()"); 313 | 314 | /* allocate cmd_exe object */ 315 | if ((cmd_line = browser->memalloc(sizeof(*cmd_line))) == NULL) 316 | goto err_cmd_alloc; 317 | 318 | cmd_line->destroy = destroy_cmd_line; 319 | cmd_line->run = run_command; 320 | cmd_line->init_module = init_cmd_line_module; 321 | cmd_line->destroy_module = destroy_cmd_line_module; 322 | cmd_line->stop = process_stop; 323 | cmd_line->read = process_read; 324 | 325 | /* allocate buffer */ 326 | if ((buffer = browser->memalloc(BUFLEN * sizeof(*buffer))) == NULL) 327 | goto err_buf_alloc; 328 | 329 | /* allocate buffer for wide chars */ 330 | if ((buffer_wchar = browser->memalloc(BUFLEN_WCHAR * sizeof(*buffer_wchar))) == NULL) 331 | goto err_buf_wchar_alloc; 332 | 333 | /* allocate buffer for utf8 chars */ 334 | if ((buffer_utf8 = browser->memalloc(BUFLEN_UTF8 * sizeof(*buffer_utf8))) == NULL) 335 | goto err_buf_utf8_alloc; 336 | 337 | return true; 338 | 339 | err_buf_utf8_alloc: 340 | free(buffer_wchar); 341 | buffer_wchar = NULL; 342 | 343 | err_buf_wchar_alloc: 344 | free(buffer); 345 | buffer = NULL; 346 | 347 | err_buf_alloc: 348 | free(cmd_line); 349 | cmd_line = NULL; 350 | 351 | err_cmd_alloc: 352 | return false; 353 | } 354 | --------------------------------------------------------------------------------