?!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 分秒必争-2009 May

分秒必争

个人技术博客,笔记,杂谈之?/h2>

May
13

[原]用Python来解密VBS

用来解密如图所类似的VBS,解密后会在当前目录下生成decode.txt这个文本文件,这就是解密后的源?/p>

其实这种方法用任何语言编写都可?只是自己在学Python就用python写了一?而且python只须要几句话就行?如果去掉注释说明什么的,源码在图下面

#!/usr/bin/env python
#encoding=utf-8
import sys,WConio,os
def printgoodnews(news):
    oldcolor=WConio.gettextinfo()[4]
    WConio.textcolor(WConio.GREEN)
    print news
    WConio.textcolor(oldcolor)
usage=u"""帮助:此工具须要在命令方式下执行,若此文件命令为a.exe
则在命令下输?a.exe demo.vbs或?a demo.vbs
Http://Www.Djhui.Net    分秒必争
"""

if __name__=="__main__":

    if len(sys.argv)==1:
        printgoodnews(usage)
        sys.exit(-1)
    vbs = sys.argv[1]
    if vbs[-4:].lower()!=".vbs" or not os.path.exists(vbs):
        printgoodnews(u"不好意思,你所输入的文?%s'不是一个有\n效的VBS脚本文件或者文件不存在,请重新输入\nHttp://Www.Djhui.net\n分秒必争" % vbs)
    else:
        printgoodnews(u"""Http://Www.Djhui.net    分秒必争\n""")
        printgoodnews(u"""开始解?s,请稍等....\n""" % vbs)
        printgoodnews(u"""开始读取文?s...\n""" % vbs)
        rf = open (vbs,'r')
        rf1 = rf.read()
        rf.close()
        rf1 = rf1.lower().replace('execute','intercept')
        rf1= rf1 +"""\nSub Intercept (ee)

OutPutFile="decode.txt"
Set objFSO=CreateObject("Scripting.FileSystemObject")
Set objTXT=objFSO.CreateTextFile(OutPutFile,True,False)
objTXT.Write ee
objTXT.Close
Set objWSH=CreateObject("WScript.Shell")
objWSH.Run OutPutFile
WScript.Quit
End Sub"""
        printgoodnews(u"""开始写入临时文?..\n""")
        rf = open('temp.vbs','w')
        rf.write(rf1)
        rf.close
        del rf
        del rf1

        printgoodnews(u"""开始解?..\n""")
        os.system('cscript.exe temp.vbs >nul 2>nul')
        printgoodnews(u"""解密完成...\n""")

 

May
13

[原]VBS解密工具

用来解密如图所类似的VBS,解密后会在当前目录下生成decode.txt这个文本文件,这就是解密后的源码此工具要在命令行下运行下载地址:http://www.djhui.net/upload/vbs.rar

More...

May
5

[转]Windows下的气泡提示

这个可以在系统拖盘中加入气泡提示,源码见下?转自 http://www.3snews.net/html/50/550-20986.html

# -*- encoding: GB2312 -*-

from win32api import *
# Try and use XP features, so we get alpha-blending etc.
try:
     from winxpgui import *
except ImportError:
     from win32gui import *

import win32con
import sys, os
import struct
import time

class PyNOTIFYICONDATA:
     _struct_format = (
         "I" # DWORD cbSize;
         "I" # HWND hWnd;
         "I" # UINT uID;
         "I" # UINT uFlags;
         "I" # UINT uCallbackMessage;
         "I" # HICON hIcon;
         "128s" #    TCHAR szTip[128];
         "I" # DWORD dwState;
         "I" # DWORD dwStateMask;
         "256s" # TCHAR szInfo[256];
         "I" #     union {
             #    UINT  uTimeout;
             #    UINT  uVersion;
             #} DUMMYUNIONNAME;
         "64s" #    TCHAR szInfoTitle[64];
         "I" #  DWORD dwInfoFlags;
         #       GUID guidItem;
     )
     _struct = struct.Struct(_struct_format)

     hWnd = 0
     uID = 0
     uFlags = 0
     uCallbackMessage = 0
     hIcon = 0
     szTip = ''
     dwState = 0
     dwStateMask = 0
     szInfo = ''
     uTimeoutOrVersion = 0
     szInfoTitle = ''
     dwInfoFlags = 0

     def pack(self):
         return self._struct.pack(
             self._struct.size,
             self.hWnd,
             self.uID,
             self.uFlags,
             self.uCallbackMessage,
             self.hIcon,
             self.szTip,
             self.dwState,
             self.dwStateMask,
             self.szInfo,
             self.uTimeoutOrVersion,
             self.szInfoTitle,
             self.dwInfoFlags)

     def __setattr__(self, name, value):
         # avoid wrong field names
         if not hasattr(self, name):
             raise NameError, name
         self.__dict__[name] = value

class MainWindow:
     def __init__(self, title, msg):
         message_map = {
                 win32con.WM_DESTROY: self.OnDestroy,
         }
         # Register the Window class.
         wc = WNDCLASS()
         hinst = wc.hInstance = GetModuleHandle(None)
         wc.lpszClassName = "PythonTaskbarDemo"
         wc.lpfnWndProc = message_map # could also specify a wndproc.
         classAtom = RegisterClass(wc)
         # Create the Window.
         style = win32con.WS_OVERLAPPED | win32con.WS_SYSMENU
         self.hwnd = CreateWindow( classAtom, "Taskbar Demo", style, \
                 0, 0, win32con.CW_USEDEFAULT, win32con.CW_USEDEFAULT, \
                 0, 0, hinst, None)
         UpdateWindow(self.hwnd)
         iconPathName = os.path.abspath(os.path.join( sys.prefix, "djhui.ico" ))
         icon_flags = win32con.LR_LOADFROMFILE | win32con.LR_DEFAULTSIZE
         try: hicon = LoadImage(hinst, iconPathName, win32con.IMAGE_ICON, 0, 0, icon_flags)
         except: hicon = LoadIcon(0, win32con.IDI_APPLICATION)
         flags = NIF_ICON | NIF_MESSAGE | NIF_TIP
         nid = (self.hwnd, 0, flags, win32con.WM_USER+20, hicon, "Balloon  tooltip demo")
         Shell_NotifyIcon(NIM_ADD, nid)
         self.show_balloon(title, msg)
         time.sleep(5)
         DestroyWindow(self.hwnd)

     def show_balloon(self, title, msg):
         # For this message I can't use the win32gui structure because
         # it doesn't declare the new, required fields
         nid = PyNOTIFYICONDATA()
         nid.hWnd = self.hwnd
         nid.uFlags = NIF_INFO
         # type of balloon and text are random
         nid.dwInfoFlags = NIIF_INFO
         nid.szInfo = msg
         nid.szInfoTitle = title
         # Call the Windows function, not the wrapped one
         from ctypes import windll
         Shell_NotifyIcon = windll.shell32.Shell_NotifyIconA
         Shell_NotifyIcon(NIM_MODIFY, nid.pack())

     def OnDestroy(self, hwnd, msg, wparam, lparam):
         nid = (self.hwnd, 0)
         Shell_NotifyIcon(NIM_DELETE, nid)
         PostQuitMessage(0) # Terminate the app.

def show_msg(title, msg):
     w=MainWindow(title, msg)
     #PumpMessages()

if __name__=='__main__':
     show_msg("有一条消?quot;, "哈哈?quot;)
 

May
5

Python监视进程

由subprocess创建一个进程,然后进行监视
每一秒钟查看一次,如果正在运行,打印pid和running,如果已停止?继续执行任务并打印Termined
shell和stdout均设置为False
也许这对做病毒的守护进程很好

#!/usr/bin/env python
import subprocess , sys , time
p=subprocess.Popen(['ping','127.0.0.1','-n','10'], shell=False,stdout=False)
while 1:
    time.sleep(1)
    ret=subprocess.Popen.poll(p)
    if ret is None:
        print p.pid,"running"
    else:
        print "Termined!"
        p=subprocess.Popen(['ping','127.0.0.1','-n','10'], shell=False,stdout=False)
 

May
4

快速制作U盘工?/a>

自己在做U盘工具的时候找了很多资料才做成功,为什么要做U盘工具盘,很简单,维护系统,系统崩溃的时候可以用无须一张大大的光盘,便于随身携带。此工具盘功能如下,一盘常用的工具都包括在里面了,可能有些软件比较旧,我也不更新了,能用就行了。矮人dos工具箱V5.0PQ分区魔术师双语版DM9.75HWINFO系统测试硬盘再生器微型WIN-PE(by老毛?故障恢复控制台清?000/XP密码KV2006 D

More...

分页:«1»

日历

<< 2010-5 >>

Sun

Mon

Tue

Wed

Thu

Fri

Sat

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21

22

23

24

25

26

27

28

29

30

31

Channels

Statistics

  • 文章总数:307
  • 评论总数:299
  • 引用总数:0
  • 浏览总数:385638
  • 留言总数:83
  • 当前主题:Aleea主题
  • 当前样式:Aleea

图标汇集

Powered By Z-Blog 1.8 Walle Build 100427   UNISON UPDATE Copyright www.djhui.net. Some Rights Reserved. 浙ICP?9017588?/h3>