System & Nethood


System & Nethood29 Jul 2008 09:34 pm

Last time I have shown a very simple/stupid user script to auto login hkej.com ( 信報財經新聞網站 )

In fact, what it does is not auto log in, but check if you are checked out and try to log-in once. It does not safe you ( me ) from cookie expires. Although it does re-log and so user can go back and click on the link to escape.

I find no way to manipulate cookie with GreaseMonkey directly. This is not too bad in terms of security. I don’t have to steal cookies. I just want to revive them.

1) The simplist trick is to reload the page:

window.setTimeout(window.location.reload,29min_later);

It works. But what if the user left some valuable words in forms ?
All such data will be vanished.

2) Do some minimal ajax load
I cannot sure why, but it does not work. It seems the ajax load within Greasemonkey is bounded by some shields.

3) Load some data into an iframe, and reload the iframe from time to time.
It works. Rather than expected, I can hide those iframe without anyharm.

So I rewrite the code a little bit. This time, I have also taken reference from a famous user script to handle username and password.

Wondering if I shall submit it to userscripts.org ….
Would do so if anyone interested.


// ==UserScript==
// @name Hacks on HKEJ
// @namespace info.bencrox
// @description Make life easier with hkej.com
// @include http://*.hkej.com/*
// @exclude http://*.hkej.com/*/adv/*
// @exclude http://*.hkej.com/*/login.jsp
// ==/UserScript==
	
// ! Private Credentials, BEWARE !
LOGIN_EMAIL = GM_getValue('ejregem','');
LOGIN_PASS = GM_getValue('ejregpw','');
	
// Note : lots FIXME
// by : lxb [at] hkday [dot] net
// ver : 0.1.013 [ 2008 Jul 25 20:00:04 ]
// ! Change Log !
// 0.1.000 [ 2008 Jul 25 18:01:12 ] : base GM + jQ ref htt://www.joanpiedra.com/jquery/greasemonkey
// 0.1.001 [ 2008 Jul 25 18:13:02 ] : add checkLogin() , use Google hosted jQuery
// 0.1.002 [ 2008 Jul 25 18:13:02 ] : checkLogin() add fail handling
// 0.1.003 [ 2008 Jul 27 19:02:13 ] : add excludes
// 0.1.004 [ 2008 Jul 27 22:04:20] : test window.location.reload  and GM Menu
// 0.1.005 [ 2008 Jul 27 22:07:56] : test with partial ajax reload, failed
// 0.1.006 [ 2008 Jul 27 22:13:28] : test with iframes, worked
// 0.1.007 [ 2008 Jul 28 17:35:44] : reload iframes in hidden div by setTimeout
// 0.1.008 [ 2008 Jul 29 21:50:13] : test with GM_setValue / getValue
// 0.1.009 [ 2008 Jul 30 16:02:32] : fixed GM_setValue by not using jQuery
// 0.1.010 [ 2008 Jul 30 16:04:58] : allow manual reset un/pw , blank pw  , ref : http://userscripts.org/scripts/review/16341
// 0.1.011 [ 2008 Jul 30 16:56:16]: fix re-bake loop by adding excludes and choosing better dummy pages
// 0.1.012 [ 2008 Jul 30 17:15:21]: test with extra styling / manual items
// 0.1.013 [ 2008 Jul 30 20:00:04]: clean up test codes
	
// - Change Log -
	
// Add jQuery
var GM_JQ = document.createElement('script');
GM_JQ.src = 'http://ajax.googleapis.com/ajax/libs/jquery/1.2.6/jquery.min.js';
GM_JQ.type = 'text/javascript';
document.getElementsByTagName('head')[0].appendChild(GM_JQ);
	
// Check if jQuery's loaded
function GM_wait() {
if(typeof unsafeWindow.jQuery == 'undefined') { window.setTimeout(GM_wait,100); }
else { $ = unsafeWindow.jQuery; letsJQuery(); }
}
GM_wait();
	
//renewCookie by fetch the smallest pieces.
//FIXME: they are not quite small... seems idiot method...
    function renewCookie() {
	$('#webifm').attr('src','http://web.hkej.com/template/registration/jsp/login.jsp');
	$('#wwwifm').attr('src','http://www.hkej.com/template/registration/jsp/login.jsp');
    }
	
//call renew cookies every 25mins
    function cookieTimeout() {
	renewCookie();
	window.setTimeout(cookieTimeout,1500000);
    }
	
//provide some way to reset Creds stored in firefox
//FIXME: tell me if I can encrypt things ... -_-
    function resetCredentials(){
		if ((LOGIN_EMAIL = prompt('Registered Email:')) != null){
			GM_setValue('ejregem',LOGIN_EMAIL);
		} else return;
		if ((LOGIN_PASS = prompt('Password (leave blank to prompt every time):')) != null){
			GM_setValue('ejregpw',LOGIN_PASS);
		}
    }
	
// Provide a button to reset Creds if login failed
    function checkLogOK(){
// FIXME: Yes, this must lead to faults afterwards
	ts = document.getElementsByTagName('b')
      if(ts.len){
// FIXME: Cannot use jQuery (GM_setValue within unsafeWindow ) here,
	resetp = document.createElement('button');
	resetp.innerHTML='Reset';
	resetp.addEventListener('click',resetCredentials,true);
	ts[0].appendChild(resetp);
      }
    }
	
// Extract the Log in Operation for manual use
    function AutoLog() {
	if (LOGIN_EMAIL == '') resetCredentials;
	if (LOGIN_PASS == '') LOGIN_PASS = prompt('Password :');
	
// FIXME : this must fail afterward, yes, yes...
	$('#wrapper table:first td:eq(1)')
	  .load('/template/registration/jsp/_login_prg.jsp #regWrap b',
		{login:LOGIN_EMAIL,password:LOGIN_PASS},checkLogOK);
	
    }
	
// Check login
function checkLogin() {
// FIXME : it may not work if hkej update itself
	var login = $('img#Reg_Log').attr('src').indexOf('logout') + 1;
	if (!login) AutoLog();
	cookieTimeout();
}
	
// Hide the cookie ovens
    function Addiframe(){
	$('<div id= "hid"></div>').appendTo('body');
	$('<iframe name="webifm" id="webifm"></iframe>').appendTo('#hid');
	$('<iframe name="wwwifm" id="wwwifm"></iframe>').appendTo('#hid');
	$('#hid').hide();
    }
	
// All your GM code must be inside this function
function letsJQuery() {
	Addiframe();
	checkLogin();
}
	
GM_registerMenuCommand('Login', AutoLog);
GM_registerMenuCommand('Reset ID',resetCredentials);
	

Have fun!

System & Nethood29 Jul 2008 03:30 pm

The ’session expires’ problem kicks me ass again. Thus I open firebug to check how can I extend life.

Adding Firecookie save my time for this task. Yet, up to version 0.6 firecookie shows expire time in GMT only.
I think not much people lives / syncs with GMT. Adding options for proper localized timezone would be nice.

Thus, I filed an issue for the developer.

For those who don’t want to wait, please locate your own ‘firecookie.js’ and s/toGMTString/toLocateString/g .
I don’t think this is a considerate hack. Bear your own risk if you are as lazy as I am.


Notes:
XPI can be upzipped… Tell you, I have not hack things for a long time. I googled decompile xpi … how stupid am i …

Notes 2:
Is that GreaseMonkey does not touch cookies anymore ?
I find that extracting content with jQuery ajax load into a div does not help, but adding a visible iframe does.

System & Nethood16 Jul 2008 07:19 pm

This is nothing new. When the major corporate software solution vendors stress on user experience, shut their mouth with game designs.

And this is why game designers, especially 2D flash / web base / multi-user online experts SHOULD consider pitching the corps.

Ask the bosses, How much does their company spend on software solution last year ?

How much is your design team earn ?

If the numbers match, show what have you done for User Interface / User eXperience / User InterActions.

It is time to mix up work and game play. Believe me, the major vendors HAVE open their back doors for you. And don’t forget to compare your game server’s uptime with the corps.

All in, take it all!

System & Nethood11 Jul 2008 06:43 pm

I am no friend of windows, but can be still considered as neutral towards microsoft.
So, today’s MUST topic is iphone 3G , be practical, go to check PK Chan’s chart.

I have no luck in HTHK’s lucky draw. Even worse, I was appointed to attend Microsoft HK’s MIX essentials 2008.

That’s done?

No.

MS’s web technology lag is still there, MS HK has even more jet lag. Since I do not subscribe news from MSDN, my lag makes the previous mentioned negligible.

1. Windows Live ID can be used as a SSO passport ( nothing new ) , for FREE ( really ? )

2. After the merger of UWANTS and DISCUSS.COM.HK , the local forum giant is migrating their back end from Linux to Windows 2008 , says Oscar ( of UWANTS ) , with charts about performance and stability gain. ( WTF ??? )

- rational 1 - there are more Certs MS engineers, while not much hard core linux guys.
Ben consider this is TRUE
- rational 2 - their new h/w cannot be driven to max power by linux, because of driver issue.
Ben has a little doubt…. but it can be TRUE
- rational 3 - MSWS 2008 serves more PV per machine
Hey… you deploy those MSWS 2008 with NEW h/w, not right ? Is the comparison fair ???
- rational 4 - MSWS 2008 does not hang so far ( after half year of prod. deploy )
OK, MS does a good job
- rational 5 - MSWS 2008 supports PHP and fastcgi
Ben: WTH your linux + apache guys NOT deploying fastcgi ( or memcached and blah blah blah ) ?????

3. The HKGOLDEN guys ( in fact from Fevaworks ) show new feature for IE 8 users
Ben: they are misleading on what is RSS. they are not using Microformats, hey !

4. With silverlight and expression and blah blah blah, 蘇絲黃 ’s new site 07807.com has been a flashy showcase.

Done.

( and MS gives out pipes of Silverlight books and MIX shirts )

System & Nethood25 Jun 2008 03:09 pm

Yesterday I read a post on color and web accessibility ( in Traditional Chinese ) from Jedi’s Blog. It refers to Joe Dolson’s Color Contrast Test web app, for which Jedi has contributed the Tradition Chinese version.

At that moment, user has to key in a HEX color code to begin with. I think adding a javascript color picker will further enhance accessibility, thus I send suggestion to Joe.

Surprised, the color picker is integrated after a flash, and I find Joe’s reply in my mailbox.

Believe or not, I send suggestions to varies webmasters at least every week, about one third will reply me within a month ( and that is not bad ) . Joe breaks my record of suggestion respond time. He is truly accessible and make the contrast.

Two thumbs up ! More news by category Topic -: Buy phentermine saturday delivery ohio Tramadol hydrochloride tablets Picture of xanax pills Free shipping cheap phentermine Buying phentermine without prescription Safety of phentermine Pyridium Generic viagra cialis Cialis generic india Pink oval pill 17 xanax identification Buy free phentermine shipping Best price for generic viagra Information about street drugs or xanax bars Ordering viagra Snorting phentermine Hydrocodone overdose Lithium Amiodarone Get online viagra Order viagra prescription Order xanax paying cod Cheap phentermine free shipping Imiquimod Tramadol next day Linkdomain buy online viagra info domain buy onlin Pfizer viagra sperm Vidarabine Cheapest viagra price Prevacid Viagra cialis levitra comparison Dutasteride Lisinopril Thiotepa Female spray viagra Black market phentermine Betamethasone Cialis forums What does xanax look like Loss phentermine story success weight Order xanax overnight Viagra alternative uk Diet online phentermine pill Order xanax cod Mecamylamine Eulexin Cheap hydrocodone Buy cheapest viagra Viagra xenical Phentermine with no prior prescription Xanax in urine Macrodantin Cheap phentermine with online consultation Epivir Buy phentermine epharmacist Ditropan Woman use viagra Cialis erectile dysfunction Xanax withdrawl message boards Viagra online store Atorvastatin Generic ambien Is phentermine addictive Next day delivery on phentermine Buy online viagra Ethanol Natural phentermine Avandamet Xanax long term use Diet page phentermine pill yellow 5 cheap Cheapest secure delivery cialis uk Information medical phentermine Cialis experience Phentermine no perscription Compare ionamin phentermine Viagra cialis levivia dose comparison Noroxin Effects of viagra on women Buy cheap cialis Viagra shelf life Hydroxyurea Phentermine discount no prescription Buy cheap online viagra Dog xanax Online cialis Viagra class action Viagra price Phentermine without prescription and energy pill Hydrocodone cod only Nicoumalone Cheapest viagra Cheap ambien Vicodin without prescription Phentermine prescription online Phentermine snorting Mirtazapine Quazepam Isradipine Buy generic viagra online Xanax look alike Moxifloxacin Viagra experiences Piroxicam Nicorette Free try viagra Sotalol Cash on delivery shipping of phentermine How do i stop taking phentermine Xanax prescriptions Cheapest phentermine 90 day order Niacinamide Phentermine weight loss Phentermine

System & Nethood28 May 2008 07:34 pm

Oh my ~!
Please refer to Facebook
And Barcamp Wiki

Message from Napoleon Biggs:

BarCamp HK 2008 - UPDATE!

We have a new venue and date set for BarCamp HK 2008!

Date: 9th August, 2008 New date ! Sat 6th, September 2008
Venue: 30/F, Oxford House, Taikoo Place, Quarry Bay.

Hosted by Turner International Asia Pacific, famous for Cartoon Networks, CNN, TIME and Fortune.

There will be five large conference rooms, two lounge areas, a coffee room and a bar. Free wifi is also provided.

If you’d like to help with organising the event, then please contact Napoleon Biggs.

Or post your ideas to the wiki (thanks for setting this up, Aaaron):

I hope I can migrate my blog before it takes place …

System & Nethood23 Jan 2008 05:58 pm

很久沒有寫東西,近來都在煩程式開發。正在愁閉門造車有多不健康,就找到個機會做少許可以公開的指引。

剛先收到一位朋友的信,問我怎樣用 ,去做一個實驗,以偵察一大堆電話號碼,到底是機器應答 ( ),還是真人應答,定還是傳真機。他想把資料存入 MySQL ,以便稍後分析。

像這樣的做法,在電訊工程方面實在十分普遍,已經有很多人做過實例。是故只要問一問 Google 大神,應該很易得到指引。我在這裏只是用中文撮要一下,方便 Google 大神回答中文世界的懶人。

實作的前題,是要有一台安裝好 Asterisk ,插了 ATA / FXO 界面卡,駁好電話線,以及有一堆不介意被偵察的電話清單。

再提一次,要是亂槍打鳥而滋擾到本港用戶,基本上是犯法的。目前很多商業機構,都是透過委託非牟利團體,去做實則關乎商業利益的電話調查,以便隱藏來電線路。他們以為這樣子,就可以繞過了「在 發 送 商 業 電 子 訊 息 至 電 話 或 傳 真 號 碼 時 , 不 得 隱 藏 來 電 線 路 識 別 資 料」的規定,這實在是超糟糕的。

回到正題,一般新手去搞 Asterisk ,搞大輪安裝好了,也就只是知道怎樣接電話。要再下一城,弄出一個應用方案,關鍵就在於怎接連自己會寫的應用程式。

以電話類別偵察為例,運作的流程可能是這樣:

1. 定義電話號碼清單。
2. 定義撥號次序。(也許只是純粹順著清單撥打)
3. 撥打號碼。( 可能是多線進行)
4a. 號碼接通,辨別接聽端為何物。
4b. 未能接通,分辨原因。
5. 紀錄 4a/b 的相關資料
6. 提取下一個號碼,重複 3 ~ 5 ,直至沒有新號碼

由於開發工具不是一蹴即就,無關電訊運作的邏輯部份,亦即是 (1) (2) (6) 宜於抽出來編寫,只要用熟悉的 Scripting Language 便可以輕鬆搞定。

(5) 基本上也和電訊運作無關,只是其觸發點仍是以 (3) (4) 有結論為前提,用的資料也是由電訊邏輯提供,應用 Asterisk 的 API 更為簡單直接。譬如說,我的朋友打算用 MySql 存案,我提議他參考這個:

http://www.voip-info.org/wiki/view/Asterisk+cmd+MYSQL

另一點,外部程式要使用 asterisk , 像是觸發 (3) ,則可以參這個:

http://www.voip-info.org/wiki/view/Asterisk+auto-dial+out

最後,怎樣用 Asterisk 判別接聽端為何物呢?其實例子也挺多的,像是

這個分辨 Fax 機的插件程式
以及這個有關辨認人和應答系統的功能

至於如何把現有的東西改良,那當然要靠實際開發者的智慧了。

System & Nethood20 Dec 2007 12:01 pm

前天提及EEEpc 介紹會,似乎正體是 HKPUG 的十周年聚會,故由 HKPUG 安排登記

未知熟為主熟為客,如果為 EEEpc 用戶聯誼為目的,那麼為了後續保持聯絡,實在該有點準備。

由於之前有約﹐而剛剛才取消﹐我拖到今天才去登記參加是次活動。按登記頁所示,入場名額僅 100 個,而其後者,得留待候補。我登記到的,己是 121 號,希望還擠得入去吧?

按預計,EEEpc 在香港賣了上千部,估計當下在港用戶應不下 500 之數。近來出席過好幾個網友活動,總不免會撞到三五個人﹐手上捧著的就是 EEEpc ,可見這台廉價電腦己開始普及。

現我手上的那部 EEEpc ﹐早已轉讓給公司作開發用﹐所以不單拆開解剖過,也難免將就同事,安裝了 WinXp ,加到 2 G ram ﹐食電速度果然不同凡響!

據知美國的 EEE用戶,已爭取到拆開封條加 RAM ,可以繼續享有保養服務,倒是華碩的國際官網,並沒有跟進修改相關條文( 留意 A - e ) ,所以我這次最想搞清楚的,就是這點。

另外,如果許可,我也會示範一下用 EEEPC 經 3G HSUPA 上網。

System & Nethood17 Dec 2007 04:14 pm

終於有消息﹐華碩會於 21 日發佈介紹會﹐並會聯同 hkpug 探討 eeepc 應用

華碩 EeePC 產品介紹及HKPUG十週年慶祝

( 按: 此活動需要在 hkpug 登記 )

日期:2007-12-21
開始時間: 19:30 — 22:00
地點: New Horizons Learning Centre of Hong Kong
香 港 灣 仔 港 灣 道 25 號 海 港 中 心 2 樓 201 室 Room J + K

活動程序表

1. ASUS 公司簡介
2. ASUS EeePC 及其他產品介紹
3. 多位 EeePC 用家之心得
4. 自助小食及 EeePC 試玩
5. EeePC 之預裝Linux 的特色
6. 示範用 EeePC 作流動伺服器, Photo Gallery, Online Store, CMS, Forum, etc.
7. 裝了Windows XP Professional 之 EeePC示範
8. EeePC 遙控其他電腦的方案 — VNC, Remote desktop, LogmeIn on EeePC

( 謝謝 BenLau 通知。)

Mobile30 Oct 2007 05:26 pm

我想到的﹐除了是作 3G router 外﹐還有一些古靈精怪的 Share LAN desktop 應用。

比如說﹐可不可以做 Display Array ?( 完全呆掉…)

實際一看點﹐Mobile Local ( Adhoc / Meshed) Network 尚且是一個處女地﹐尤其是在機種完整的流動電腦上﹐可待發掘的空間應該很大。

舉一個最簡單的例﹐以 Synergy 之類的工具 Adhoc 縫合兩個或更多的 Desktop ﹐會是甚麼境象呢?也許是一種新的近端 p2p Desktop Sharing 。

近端電腦﹐最值得分享的不是內容﹐而是機能。

是故﹐更值得探索的是﹐EEEpc 是一個萬能工具的接口(處理器)。一台 EEEpc 的處理和聯接能力有限﹐但多台 EEEpc 卻可以分工合作﹐各自控制不同的組件﹐產生一個蟻群網絡。比如說﹐在一架車上裝一台 EEEpc 相容的智能系統(主要是一個攝錄鏡頭)﹐就可以透過層遞分享﹐把路面情況由近至遠地相傳。又比如﹐ 把 EEEPC 的處理時間( Processing time ) 和網絡端口( Bandwitch / IP-based identity) ﹐分享給近端的電腦﹐那就會形成湊集規模效應﹐形成網格電腦 ( Grid-Computer ) 、聲東擊西的保安 Routing (有點像洋葱網)。

« Previous PageNext Page »


Listed on BlogShares