分类: Program

WEB化批量执行命令&文件上传

  作者:wangxun 本文中将更进一步使用Tornado提供一个WEB界面,通过WEB界面操作即可实现批量命令执行、文件上传。 首先我们需要一个资料库来存放主机信息。本文中我们使用SQLite,我们建立一张表:myhost 表中创建四个栏位:ID、HOST、USER、PWD分别记录序号,主机名、主机登入用户名、登入密码。 SQL如下: CREATE TABLE "myhost" ( "ID" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "HOST" TEXT(36), "USER" TEXT(36), "PWD" TEXT(36) ) Python: # -*- coding=utf-8 -*- import sys reload(sys) sys.setdefaultencoding('utf-8') import tornado.web import tornado.httpserver import torn

阅读全文

svn 版本库的创建和配置

1.创建SVN版本库 mkdir trunk svnadmin create /root/trunk/svntest #这里是路径和即将创建的版本库名称 复制代码 2.配置svn cd /root/trunk/svntest/conf #配置文件所在的目录 vim svnserve.conf  #anon-access:匿名用户的权限,可以为read,write和none,默认值read。不允许匿名用户访问:anon-access = none             #auth-access:认证用户的权限,可以为read,write和none,默认值write。             #password-db:密码数据库的路径             #authz-db:认证规则库的路径 复制代码 去掉相关注释 vim passwd               #配置用户名字和密码  格式:用户名=密码 复制代码 vim authz               #group_one是组名  myuser是属于group_one组                     #[/]配

阅读全文

Python抓网页上的图片

# -*- coding: utf-8 -*- import urllib, httplib, urlparse import re import random """judge url exists or not,by others""" def httpExists(url): host, path = urlparse.urlsplit(url)[1:3] if ':' in host: # port specified, try to use it host, port = host.split(':', 1) try: port = int(port) except ValueError: print 'invalid port number %r' % (port,) return False else: # no port specified, use default port port = None try: connection = httplib.HTTPCo

阅读全文

Sqlite语法

id字段自增 sql="CREATE TABLE IF NOT EXISTS MusicList (id integer primary key AutoIncrement,name varchar(20),path varchar(20))";      <br>常用Select语句 desc <table> //查看表结构 select * from <table> //查询所有更 select , from table ;//查看指定列 select distinct , from table ;//非重复查询 insert into users(_id,username,password) select * from users;//复制 select username from users where username like 'S%' ;//非重名字首字母为大写S的用户 select username from users where username like '__S%'

阅读全文

Options for HTML scraping

I'm thinking of trying Beautiful Soup, a Python package for HTML scraping. Are there any other HTML scraping packages I should be looking at? Python is not a requirement, I'm actually interested in hearing about other languages as well. The story so far: Python   Beautiful Soup lxml HTQL Scrapy Mechanize   Ruby   Nokogiri Hpricot Mechanize scrAPI scRUBYt! wombat Watir   .NET   Html Agility Pack WatiN   Perl   WWW::Mechanize Web-Scraper   Java

阅读全文

验证码识别

1:安装 http://www.pythonware.com/products/pil/ 2:安装 https://code.google.com/p/pytesser/downloads/detail?name=pytesser_v0.0.1.zip&can=2&q= 测试结果 pytesser 识别率太低 1:取得50个样例图 import httplib for i in range(50):     url = 'http:////sysmonitor/verifyCodeServlet'     print "download", i     c = httplib.HTTPSConnection("1.1.1.1",8443)     c.request("GET", "/sysmonitor/verifyCodeServlet")     response = c

阅读全文

UnicodeDecodeError: ‘ascii’ codec can’t decode byte 0xb0 in position 1: ordinal not in range(128)

UnicodeDecodeError: 'ascii' codec can't decode byte 0xb0 in position 1: ordinal not in range(128) 原因可能与注册表错误的字符集有关,可能与某些软件对注册表的改写的gbk格式导致。   解决方法:打开C:\Python27\Lib下的 mimetypes.py 文件, 找到大概256行的 ‘default_encoding = sys.getdefaultencoding()’。 在这行前面添加三行: if sys.getdefaultencoding() != 'gbk': reload(sys) sys.setdefaultencoding('gbk') default_encoding = sys.getdefaultencoding()      

阅读全文

安装 paramiko 前置 PyCrypto

首先安装 PyCrypto – The Python Cryptography Toolkit http://www.voidspace.org.uk/python/modules.shtml#pycrypto   https://github.com/paramiko/paramiko setup.py install 如出现 error: Unable to find vcvarsall.bat 则: 命令行下执行 SET VS90COMNTOOLS=%VS100COMNTOOLS% 如果你安装的是 2012 版 SET VS90COMNTOOLS=%VS110COMNTOOLS% 如果你安装的是 2013版 SET VS90COMNTOOLS=%VS120COMNTOOLS%

阅读全文

java 的base64处理类

/*************************************************************** Copyright (c) 1998, 1999 Nate Sammons <nate@protomatter.com> This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warra

阅读全文

dea_des ecb 模式 java php c#实现

1.java [code lang=”java”]<br /> package com.egame.fee.sdk.pc.util; </p> <p> import java.io.IOException;<br /> import java.io.UnsupportedEncodingException;<br /> import java.security.InvalidKeyException;<br /> import java.security.NoSuchAlgorithmException;<br /> import java.security.SecureRandom;<br /> import java.security.spec.InvalidKeySpecException; </p> <p> import javax.crypto.BadPaddingException;<br /> import javax

阅读全文

简单方法捕捉手机(移动设备)网络请求

1:安装 Fiddler,在其 Tools –> Fiddler Options –> Connections 选中 Allow Remote Computers to Connect. 2:记录 Fiddler 所在机器的IP地址,如192.168.0.100 3:在移动设备(手机)的WIFI网络设置处,设置HTTP代理,将服务器填为上一步中获得的IP,即192.168.0.100,端口填8888 这样Fiddler即可截获手机的网络请求.

阅读全文