随笔-69  评论-0  文章-5  trackbacks-0
  2008年4月17日
先占个地儿
http://blog.csdn.net/boat1980/archive/2008/07/23/2698318.aspx

posted @ 2008-09-22 11:36 liunix 阅读(222) | 评论 (0)编辑 收藏
<html>
<head>
<script>
function overlay() {
    el 
= document.getElementById("overlay");
    el.style.visibility 
= (el.style.visibility == "visible"? "hidden" : "visible";
}
</script>
<style>
body 
{
     height
:100%;
     margin
:0;
     padding
:0;
}
/*外层全部*/
#overlay
{
     visibility
: hidden;
     position
: absolute;
     left
: 0px;
     top
: 0px;
     width
:100%;
     height
:100%;
     text-align
:center;
     z-index
: 1000;
     background-color
:#000;
     filter
: alpha(opacity=70); /*ie支持的半透明,下面两名为ff支持的*/
     -moz-opacity
: 0.7;
     opacity
:.70;
}
/*外层的显示区*/
#overlay div 
{
     width
:300px;
     margin
: 100px auto;
     background-color
: #FFFFFF;
     border
:1px solid #000;
     padding
:15px;
     text-align
:center;
}
</style>
</head>
<body id="body">
<div id="overlay">
     
<div>
        用户名:
<input type="text" name="" /><br/>
        密  码:
<input type="text" name="" /><br/>
        
<input type="button" value="关闭" onclick="overlay()" />
     
</div>
</div>

<href='#' onclick='overlay()'>Click here to show the overlay</a>
</body>
</html>   
posted @ 2008-08-29 16:23 liunix 阅读(624) | 评论 (0)编辑 收藏
一、DESede加密(对应SunJCE不提供模式和填充的情况)
declare
    result raw(
2000);
    l_mod number :
= dbms_crypto.ENCRYPT_3DES+dbms_crypto.CHAIN_ECB+dbms_crypto.PAD_PKCS5;
begin
    result :
= dbms_crypto.Encrypt(src => utl_i18n.string_to_raw('wwww'),typ => l_mod,key => hextoraw('123456789012345678901234567890123456')
    );
    dbms_output.put_line(result);
end;
/

二,摘要
dbms_crypto.Hash(utl_i18n.string_to_raw('input'),dbms_crypto.MD5))
posted @ 2008-07-21 14:54 liunix 阅读(653) | 评论 (0)编辑 收藏
用了几天jira管理对它的权限模式有了初步理解:



project和permission schema多对一,从而形成了permission schema的重用
而permission schema本身则代表了group/user和pemission之前的映射关系

另外,jira还有一个Project Role的概念更增加了jira权限管理的灵活性
其实它实质上就是一个角色(RBAC中的R),可以和group/user多对多关联,
(当然也可和Permission通过schema进行关联)
使jira的权限配置更新灵活的同时,也增加了相当的复杂性

posted @ 2008-07-17 16:06 liunix 阅读(1290) | 评论 (0)编辑 收藏
一,造libmysql.def文件
   1, ${mysql_home}/include/libmySQL.def文件如果有直接用
   2, 否则下载pexports工具,执行pexprots libmySQL.dll> libmySQL.def(libmySQL.dll在${mysql_home}/bin目录下一般会有)
二,转换成静态库
   dlltool --input-def libmySQL.def --dllname libmySQL.dll --output-lib libmysql.a -k
三,配置Eclipse(静态库和动态库加法都是-L${DIR} -l${libname},但谁的优先级高呢?)
    1, 加上库目录,如"${workspace_loc:/hello_mysql/libs}"
    2, 加上libmysql.a的库名: mysql
    3, 构建,报错:  #ff0000 reference to `mysql_real_connect@32'之类的错
    4, 修改def文件,将mysql_real_connect改成mysql_real_connect@32,其它错误同理,并重新生成静态库
    5, 重新构建完成
四,示例程序(只须修改连接信息及表名)
#include <stdio.h>
/*下面这一行一定要加上*/
#include 
<my_global.h>
#include 
<mysql.h>

int main() {
    MYSQL mysql;
    MYSQL_RES 
*result;
    MYSQL_ROW row;

    
int numrows, numcols, c;

    mysql_init(
&mysql);

    
if (!mysql_real_connect(&mysql, "localhost""opencart""opencart""opencart"0, NULL, 0)) {
        fprintf(stderr,
"Failed to connect to database: Error %d:%s\n", mysql_errno(&mysql), mysql_error(&mysql));
    }
    
char query[] = "SELECT * FROM product";

    
if (mysql_query(&mysql, query))
    {
        fprintf(stderr,
"Error executing query: Error %d: %s\n", mysql_errno(&mysql), mysql_error(&mysql));
    }

    result 
= mysql_use_result(&mysql);

    
if (!result) {
        fprintf(stderr,
"Error executing query: Error %d: %s\n", mysql_errno(&mysql), mysql_error(&mysql));
    }
    numcols 
= mysql_num_fields(result);

    
while (row = mysql_fetch_row(result)) {
        
for (c = 0; c < numcols; c++) {
            printf(
"%s\t", row[c]);
        }
        printf(
"\n");
    }
}

   
posted @ 2008-07-14 15:36 liunix 阅读(1020) | 评论 (0)编辑 收藏
一、安装
1, 安装xampp
2, 安装zend studio[6]

二、配置调式
1,在http.conf中指定php.ini的位置
    PhpIniDir "D:/xampp/php"

2, 在php.ini中的zend的部分指定以下内容(ZendDebugger.dll是从zend studio中搜出来的)
[Zend]
zend_extension_ts = "D:\xampp\php\zendOptimizer\lib\ZendDebugger_5.2.12.dll"
;下面部分可选
zend_debugger.allow_hosts=127.0.0.1/32,127.0.0.1/24
zend_debugger.expose_remotely=allowed_hosts


posted @ 2008-07-07 11:38 liunix 阅读(274) | 评论 (0)编辑 收藏
放在/usr/local/bin下,挺好用
 #!/bin/sh
 # this script converts an rpm into a plain tarball

 mkdir $$.cpio
 rpm2cpio $@ 
> $$.cpio/foo
 cd $$
.cpio
 cpio 
---< foo
 rm 
-f foo
 find 
. -type d -perm 700 -exec chmod 755 {} \;
 tar cvzf 
../`basename $@ .rpm`.tar.gz .
 cd 
../
 rm 
-rf $$.cpio


posted @ 2008-06-18 11:37 liunix 阅读(322) | 评论 (0)编辑 收藏
1,去http://rpm.pbone.net/下载下列rpm包并安装
libnasl-2.2.9-1.fc5.i386.rpm
nessus-core-2.2.9-1.fc5.i386.rpm
nessus-core-debuginfo-2.2.9-1.fc5.i386.rpm(可选)
nessus-libraries-2.2.9-1.fc5.i386.rpm
nessus-server-2.2.9-1.fc5.i386.rpm
nessus-gui-2.2.9-1.fc5.i386.rpm
2, 找个能用的邮箱去http://www.nessus.org/plugins/index.php?view=register注册一下
3, 按邮件中的方式运行nessus-fetch --register ****
4, 运行nessus-adduser增加一个没有rule的用户
5, 运行nessus-mkcert造个证书
6, 运行nessus-fetch --check检查一下状态
7, 如果前面没啥问题,运行service nessusd start
   如果这一步除了成功没啥别的输出就ok啦


posted @ 2008-06-18 10:44 liunix 阅读(260) | 评论 (0)编辑 收藏
限制本机的对外访问(例如不让测试环境访问生产库):
iptables -t filter -A OUTPUT -d 192.168.2.2 -p tcp --dport 1521 -j REJECT

#端口转发到另一台机器上
-A PREROUTING -d $ip1 -i eth0 -p tcp -m tcp --dport $port1 -j DNAT --to-destination $ip2:$port2
-A POSTROUTING -d $ip2 -p tcp -m tcp --dport $port2 -j SNAT --to-source $ip1
#本机端口相互映射
-A PREROUTING -p tcp --dport $port1 -j REDIRECT --to-port $port2
posted @ 2008-06-02 11:07 liunix 阅读(203) | 评论 (0)编辑 收藏
pre-commit.tmpl,然后更名pre-commit并加上执行权限:
#!/bin/sh

REPOS
="$1"
TXN
="$2"

RES
="OK"
# Make sure that the log message contains some text.
SVNLOOK=/app/subversion/bin/svnlook
$SVNLOOK log -"$TXN" "$REPOS" | egrep "[^[:space:]]+" >/dev/null || unset RES
if [ "$RES" != "OK" ]
then
    echo 
"You must input some comments for you commit" >&2
    
exit 1
fi

# All checks passed, so allow the commit.
exit 0


posted @ 2008-05-28 14:18 liunix 阅读(1470) | 评论 (0)编辑 收藏
fisheye(1.4.3):
    cenqua_com_licensing.atlassian.license.DefaultLicense
       isExpired(),getExpiryDate()
    cenqua_com_licensing.atlassian.license.DefaultLicenseType(重点)
       isEvaluationLicenseType(),expires().....

posted @ 2008-05-28 11:13 liunix 阅读(500) | 评论 (0)编辑 收藏

一,将pem格式的key文件导入keystore

摘抄备用:http://www.agentbob.info/agentbob/79-AB.html

说明: 经试验证书的pem文件可能通过keytool直接导入keystore中的

Apache Tomcat and many other Java applications expect to retrieve SSL/TLS certificates from a Java Key Store (JKS). Jave Virtual Machines usually come with keytool  to help you create a new key store.

Keytool helps you to:

  • create a new JKS with a new private key
  • generate a Certificate Signung Request (CSR) for the private key in this JKS
  • import a certificate that you received for this CSR into your JKS

Keytool does not let you import an existing private key for which you already have a certificate. So you need to do this yourself, here's how:

Let's assume you have a private key (key.pem) and a certificate (cert.pem), both in PEM format as the file names suggest.

PEM format is 'kind-of-human-readable' and looks like e.g.

-----BEGIN CERTIFICATE-----
Ulv6GtdFbjzLeqlkelqwewlq822OrEPdH+zxKUkKGX/eN
.
. (snip)
.
9801asds3BCfu52dm7JHzPAOqWKaEwIgymlk=
----END CERTIFICATE-----

Convert both, the key and the certificate into DER format using openssl :

openssl pkcs8 -topk8 -nocrypt -in key.pem -inform PEM -out key.der -outform DER
openssl x509 -in cert.pem -inform PEM -out cert.der -outform DER

Now comes the tricky bit, you need something to import these files into the JKS. ImportKey will do this for you, get the ImportKey.java (text/x-java-source, 6.6 kB, info) source or the compiled (Java 1.5 !) ImportKey.class (application/octet-stream, 3.3 kB, info) and run it like

user@host:~$ java ImportKey key.der cert.der
Using keystore-file : /home/user/keystore.ImportKey
One certificate, no chain.
Key and certificate stored.
Alias:importkey Password:importkey

Now we have a proper JKS containing our private key and certificate in a file called keystore.ImportKey, using 'importkey' as alias and also as password. For any further changes, like changing the password we can use keytool.



二、将私钥导出成pem文件(默认keytool是不能导出私钥的)
import sun.misc.BASE64Encoder;
import java.security.cert.Certificate;
import java.security.*;
import java.io.File;
import java.io.FileInputStream;
 
class ExportPriv {
    
public static void main(String args[]) throws Exception{
    ExportPriv myep 
= new ExportPriv();
    myep.doit();
    }
 
    
public void doit() throws Exception{
 
    KeyStore ks 
= KeyStore.getInstance("JKS");
    String fileName 
= "store.jks";
 
    
char[] passPhrase = "password".toCharArray();
    BASE64Encoder myB64 
= new BASE64Encoder();
    
 
    File certificateFile 
= new File(fileName);
    ks.load(
new FileInputStream(certificateFile), passPhrase);
 
    KeyPair kp 
= getPrivateKey(ks, "alias", passPhrase);
        
    PrivateKey privKey 
= kp.getPrivate();
    
 
    String b64 
= myB64.encode(privKey.getEncoded());
 
    System.out.println(
"-----BEGIN PRIVATE KEY-----");
    System.out.println(b64);
    System.out.println(
"-----END PRIVATE KEY-----");
 
    }
 
// From http://javaalmanac.com/egs/java.security/GetKeyFromKs.html
 
   
public KeyPair getPrivateKey(KeyStore keystore, String alias, char[] password) {
        
try {
            
// Get private key
            Key key = keystore.getKey(alias, password);
            
if (key instanceof PrivateKey) {
                
// Get certificate of public key
                Certificate cert = keystore.getCertificate(alias);
    
                
// Get public key
                PublicKey publicKey = cert.getPublicKey();
    
                
// Return a key pair
                return new KeyPair(publicKey, (PrivateKey)key);
            }
        } 
catch (UnrecoverableKeyException e) {
        } 
catch (NoSuchAlgorithmException e) {
        } 
catch (KeyStoreException e) {
        }
        
return null;
    }
 
}
 

posted @ 2008-04-17 16:27 liunix 阅读(7966) | 评论 (0)编辑 收藏