3月 29

linux shell 加密

经常使用脚本,但是在脚本中写入密码明文很不安全,所以考虑加密问题。当前比较普遍、简单的方法为使用shc程序
把脚本使用RC4加密算法再编译一次。

shc的主页
http://www.datsi.fi.upm.es/%7Efrosal/
当前最新为http://www.datsi.fi.upm.es/~frosal/sources/shc-3.8.7.tgz

具体操作如下
# wget http://www.datsi.fi.upm.es/~frosal/sources/shc-3.8.7.tgz
# tar zxvf shc-3.8.7.tgz
# cd shc-3.8.7
# make test
# make strings
到此,目录下已经有了shc的程序,可以直接使用,如果希望使用方便也可以在安装一下。
# make install

安装完成,非常简单。使用也非常简单。
# ./shc -v -f myshell.sh
编译完成后会产生两个myshell.sh.x和myshell.sh.x.c。myshell.sh.x为二进制文件,
myshell.sh.x.c为C源码文件。

3月 25

delphi简单代码收集

【收集人:张子萌 】

1. Form1中调用Form2窗口

Form2.ShowModal; //显示form2窗口

Form2.close; //关闭窗口

2. 获取title,可查看UTF-8编码

procedure TForm2.Button1Click(Sender: TObject); //获取title
var
webboby:string;
r:TRegExpr;
s1:string;
charseti:integer;
gethttp:Tidhttp;
begin
gethttp:=Tidhttp.Create(self);
webboby:=gethttp.Get(Edit1.Text);
charseti:=pos(‘charset=’,webboby);
if (copy(webboby,charseti+8,3)=’utf’) or (copy(webboby,charseti+8,3)=’UTF’) then
webboby:=UTF8Decode(webboby);
s1:=”;
r:= TRegExpr.Create;
try // ensure memory clean-up
r.Expression := ‘[^a]*‘;
if r.Exec(webboby) then
REPEAT
s1 :=r.Match [0];
Edit2.Text:=s1;
UNTIL not
r.ExecNext;
finally
r.Free;
end;
end;