顯示具有 chrome 標籤的文章。 顯示所有文章
顯示具有 chrome 標籤的文章。 顯示所有文章

2014年2月10日 星期一

[tiny] firefox 跟 google-chrome 跳過擋 port 的限制

Google 跟 firefox 都會針對某些安全上的考量,所以不允許用某些 port 來瀏覽網路。所以像 http://URL:110/ 或 http://URL:21/ 這樣的 URL 都會被擋下來,避免非法的使用。

但是這樣的使用方式,其實在某些 MIS 管的很嚴雞婆的時候,就會造成妨礙。

所以這篇要簡短註記一下, firefox 跟 google-chrome 怎麼跳過這種限制:

firefox 是在 pref.js 底下加入:
user_pref("network.security.ports.banned.override", "110,21"); 

google-chrome 是在 command line 底下加入:
--explicitly-allowed-ports=601

--
2014-02-20 更新:
google-chrome 在 linux 底下啟動 script 的修正有點麻煩,改在 google-chrome.desktop 底下基本上是沒辦法用到 xdg-open 上面的,所以要更新到 /usr/bin/google-chrome 的啟動的 script 裡面去:
--- /usr/bin/google-chrome.old      2014-02-20 10:21:54.072225459 +0800
+++ /usr/bin/google-chrome   2014-02-20 10:21:03.460228563 +0800
@@ -48,5 +48,6 @@
   fi
 fi
 
+EXTRA_OPT="--explicitly-allowed-ports=110,21"
 # Note: exec -a below is a bashism.
-exec -a "$0" "$HERE/chrome" --user-data-dir="${XDG_CONFIG_HOME:-${HOME}/.config}/google-chrome-unstable" "$@"
+exec -a "$0" "$HERE/chrome" --user-data-dir="${XDG_CONFIG_HOME:-${HOME}/.config}/google-chrome-unstable" "$@" $EXTRA_OPT

--
參考資料:
* http://www-archive.mozilla.org/projects/netlib/PortBanning.html
* https://productforums.google.com/forum/#!topic/chrome/wVmm0ZPexbA

2013年12月10日 星期二

[HACK] IP-CAMERA ID002A firmware backup [2]

之前寫過這篇 Hack ID002A Camera 的記錄,成功的更新 WebCam 的 script。

後來在 chrome 上面找到 tampermonkey 可以直接修改 script ,就寫了下面 script 出來,現在可以直接使用方向鍵上、下、左、右來控制 webcam 的方向了。

// ==UserScript==
// @name My Fancy New Userscript
// @namespace http://use.i.E.your.homepage/
// @version 0.1
// @description enter something useful
// @match http://YOUR_WEBCAM_URL:PORT/*
// @require http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js
// @copyright 2012+, You
// ==/UserScript==
document.body.onkeydown = function(e){
var lbl, cmd;
switch (e.which) {
case 38: /* Up */
lbl = "Up";
break;
case 40: /* Down */
lbl = "Down";
break;
case 37: /* Left */
lbl = "Left";
break;
case 39: /* Right */
lbl = "Right";
break;
}
cmd = "/cmd.xml?cmd=moveptz&tick=100&dir=btnPtz" + lbl + "&nPtzTimes=0";
$.ajax({url: cmd, success:function(event){
var cmd = "/cmd.xml?cmd=moveptz&tick=100&dir=none&nPtzTimes=0";
$.ajax({url: cmd });
}});
};


--
參考資料:
[HACK] IP-CAMERA ID002A firmware backup