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

從XP到7

昨天終於把用了多年了XP丟到硬碟角落裡變成救急用的系統了。

停用服務或功能:
  • Superfetch(有了SSD還需要嗎?)
  • Windows Defender
  • Windows Search
  • Windows Live ID Sign-in Assistant
  • Windows Backup
  • Windows Presentation Foundation Font Cache 3.0.0.0
  • Theme
  • Easeus Agent(做完備份就可以調整為手動了,可以省下約20MB左右的記憶體)
  • 硬碟重整
  • 系統還原
  • UAC(只有我在用,亂搞也還有備份系統跟備份檔案,關了省心啊)

Firefox userChrome.css(改Menubar字型與大小,要不然真的很小很難看)
/*
 * Do not remove the @namespace line -- it's required for correct functioning
 */
@namespace url("http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"); /* set default namespace to XUL */


*{font-size: 12pt !important}
*{font-family:"メイリオ", "メイリオ", "メイリオ";} 
其他參閱:

自動登入參閱:

自動撥接參閱:

關閉休眠功能(桌機用不到休眠,可以省下等同於記憶體大小的空間):

  1. 建立高效率的電源計畫
  2. 關閉休眠功能 powercfg -h OFF



重新調整分頁檔大小: 4G太多了,1G就很夠用了

接著把可攜版的程式加入右鍵選單就搞定了

The Dark Side of NTFS

我真的很喜歡這種標題~XD~,扯遠了。

抓回來的一堆ACG檔案,有些額外的資料想要跟檔案『綁』在一起。
之前用XML檔案的方式,遇到改檔名就破功。所以,才想到要把資料塞到Filesystem裡面。

在NTFS裡面有兩種儲存metadata的方式:
  1. COM Structured Storage
  2. ADS(Alternate Data Streams)
下面有幾篇文章介紹ADS:
ADS commandline tools
上面是用notepad檢視ADS內容,更簡單的檢視方式是用:
more < filename:stream

目前看來ADS有趣的多(?)。ADS新增很容易,也很好修改,不過刪除有點麻煩。
'Create File
echo Hello World! > 1.txt

'Add data stream 
echo http://www.google.com.tw > 1.txt:URL

'Edit data stream
echo http://tw.yahoo.com > 1.txt:URL

'Delete data stream
more < 1.txt > 1.txt.new
del 1.txt
ren 1.txt.new 1.txt



10 Things to know about ADS
  1. There is no limit on the size of streams and there can be more than one stream linked to a normal file. ADS are not visible in explorer or via command prompt. In fact, their size is also not reported by Windows!
  2. Streams can be attached not only to files but also to folders and drives!
  3. The content of an ADS should not be considered limited to simply text data. Any stream of binary information can constitute a file which includes executables, Mpeg files, Jpeg files etc.
  4. ADS have no attributes of their own. The access rights assigned to the default unnamed stream are the rights that control any operation on ADSs such as creation, deletion or modification. This means if a user cannot write to a file, that user cannot add an ADS to that file. A user with guest privileges can also create such streams in every file where he has write access.
  5. Some Browser helper Objects (BHOs) have started storing their malicious files inside ADS and very few anti-spyware/malware actually detect it.
  6. Windows File Protection prevents the replacement of protected system files; it does not prevent a user with the appropriate permissions from adding ADS to those system files. The System File Checker (sfc.exe) will verify that protected
    system files have not been overwritten, but will not detect ADS.
  7. Microsoft Windows provides no tools or utilities either within the operating system software distribution or the Resource Kits for detecting the presence of ADS.
  8. The stream can only be executed if called directly by a program with the full path to the file given. It is impossible to accidentally execute a stream.
  9. None of the Internet protocols enabling file transfer such as SMTP, FTP etc. support streams. This means that ADS can't be sent via Internet. However, files containing ADS can be sent across a local LAN provided the target drive is in the NTFS format.
  10. In certain cases, streams have been used to remotely exploit a web server. Some web servers are susceptible to having their file source read via the: $DATA stream. If a server side script such as PHP or ASP is running on a web server which is not patched properly, instead of getting output as a result of processing the script, the source code of the ASP/PHP file could be viewed by using a URL like this:

    http://www.abcd.com/index.asp::$DATA

    This is a critical vulnerability as the server-side source code could reveal sensitive information including how the site has been coded and how the information is flowing. This information could be used by the attacker to launch a specific attack on the server. 

Zotero Standalone

今天才看到有standalone版。稍微測試了一下:

  1. 消耗的記憶體不算少,空白資料庫要70MB+ (XULRunner 貢獻不少啊~)
  2. 速度比Firefox addon版快上不少
哪天才有stable release,Evernote免費版的限制不少。

Reference:

Everything SDK

在實驗Everything ETP的時候竟然發現,ETP Server當了= =|||。
好吧,我只是同時送了4個query過去,就當了>"<。找替代方案。

替代方案就是Everything SDK。
稍微測試一下,速度快很多。SDK是用IPC的方式跟Everything主程式溝通。所以Everything一定要開著,這點ETP也是一樣。

程式碼是參考(原创)在gvim中实现基于Everything SDK的极速搜索,稍作修改變成傳回list
from ctypes import *

def query(term):
    SE = windll.LoadLibrary("./SDK/everything.dll")

    strBuff=create_unicode_buffer(1024)
    SE.Everything_SetSearchW(c_wchar_p(term))

    try:
        SE.Everything_QueryW()
    except:
        SE.Everything_QueryW(0)

    results = []
    rcount = SE.Everything_GetNumResults()

    if rcount == 0:
        return results

    for x in range(0, rcount):
        SE.Everything_GetResultFullPathNameW(x, byref(strBuff), len(strBuff))
        results.append(strBuff.value)
    del strBuff, SE
    return results

Reference:

Search Everything via ETP

ETP簡單來說就是FTP+延伸指令。所以,外部程式若要利用ETP來搜尋檔案的話,需要基本的FTP支援。

  • 預設port: 5485
  • mode: PASV

Query syntax

QUERY <SP> <offset> <SP> <max> <SP> <match_case> <SP> <match_whole_word> <SP> <match_path> <SP> <search_string> <CRLF>
  • offset is the scroll bar offset (use 0 for all items)
  • max is the maximum number of visible items in the list. (use 0xffffffff for all items)
  • match_case can be non-zero for enabled, zero for disabled.
  • match_wholeword can be non-zero for enabled, zero for disabled.
  • match_path can be non-zero for enabled, zero for disabled.
  • search_string can be any number of parameters. 
Query reply
200 <SP> <offset> <SP> <count> <SP> <numfolders> <SP> <numfiles> <CRLF>
  • offset is the index offset of the first result.
  • count is the number of results that follow
  • numfolders is the total number of folders.
  • numfiles is the total number of files.
"count" results follow:
<full_path_name> <CRLF>
  • full path and file name of folder or file 

Python Example Code
def search(q, maxResult=1000, match_case=False, match_whole_word=False, match_path=True):
    # Query
    cmd = "QUERY 0 %d %d %d %d %s"%(maxResult, match_case, match_whole_word, match_path, q)

    # Query response offset control
    resp = ftp.sendcmd(cmd)
    code, offset, count, numfolders, numfiles = resp.split()

    results = []
    for i in range(int(count)):
        line = ftp.getmultiline().decode("UTF-8")
        results.append(line)

    return int(numfolders), int(numfiles), results


Reference:

Browser web scraping tools

BrowserAddonsNote
IEData Toolbar免費版有100筆資料上限
Google ChromeScraper

orbitdm.exe (Orbit Downloader)

orbitdm.exe [/i/e/c] url:
  • /i - information
  • /e - HTTP Referer
  • /c - Cookie

Orbit downloader 讓我又愛又怕

優點:
  • 體積小
  • 速度快
  • 耗用記憶體少
缺點:

  • 更新若不注意常常會被改首頁
  • 更新若不注意會裝到不知道是什麼的軟體
  • Downloader怎麼管電腦裡安裝的程式= =?














它的優點符合我心目中理想工具程式的樣貌。不過缺點就讓人怕怕的,更新程式就要很小心不能Next一路點到底。有幾點覺得怪怪的:
  • 怎麼會去檢查電腦中安裝的程式? 
  • orbitdm.exe有命令列選項,不過官網卻說不支援命令列模式? 不希望被其他程式當成工具來使用嗎?

    SiteShoter 補遺

    如果要每五分鐘對該網站做一次screenshot,
    用Siteshoter /RunConfig "cfgFile" 只做一次screenshot,之後程式就結束了。

    解決方法是:
    siteshoter /LoadConfig "cfgFile" /Start
    這樣就會每隔一段時間做一次screenshot,直到使用者關閉程式為止。

    或者是用命令列下的taskkill
    taskkill /F /IM siteshoter.exe 

    SiteShoter

    Siteshoter 將要抓取的網址設定完畢之後從成*.cfg檔案
    可用:
    siteshoter /RunConfig "設定檔案完整路徑" 來執行(不會出現任何視窗)

    siteshoter在檔名可用的變數,詳細說明可參照http://www.nirsoft.net/utils/web_site_screenshot.html

    • %url%
    • %host%
    • %name%
    • %date:[format]%
    • %time:[format]%
    最後,siteshoter的命令列選項,會蓋過cfg檔案中的設定,比較常用的是

    參數說明
    /URL指定網址
    /FILENAME指定存檔檔名
    /RunConfig "config file path"讀取設定檔並執行
    /LoadConfig "config file path"讀取設定檔
    /Start配合/LoadConfig來執行Take screenshot every .... minutes的動作