很多站长朋友们都不太清楚aidephp,今天小编就来给大家整理aidephp,希望对各位有所帮助,具体内容如下:
本文目录一览: 1、 AIDE或android平台,怎样支持swing和awt开发? 2、 如何查linux的nginx是否被挂马 3、 aide获取网页开源的代码为什么不能截取字符 4、 自学编程的软件 5、 如何RecursiveIteratorIterator在PHP中工作 AIDE或android平台,怎样支持swing和awt开发?安装windowbuilder插件即可
首先,需要知道自己的Eclipse是什么版本的.可以到Eclipse的安装目录下用记事本打开.eclipseproduct文件,version后面对应的就是版本号.
打开,里面有Update Sites,下面有Eclipse Version,Release Version,Integration Version栏目.选择对应版本的link.复制URL地址.
打开Eclipse,选择Help→Install New Software,在work with里面把得到的URL复制进去.勾选所有,点击Next安装就好了.是已经安装过的,所以按钮是灰色的。
然后新建项目,New→Project→WindowBuilder→SWT Designer→SWT/JFace Java Project
然后建立一个包,在建类的时候选择New→Other,选择WindowBuilder→Swing Designer→Application Window.类建好之后点击Design就可以进行可视化编辑了。
如何查linux的nginx是否被挂马linux系统相对比windows安全,但是有些程序上的不安全行为。不管你是什么系统,一样也会存在危险因素,在这里,我们总结出了linux系统下的一些常见排除木马和加固系统安全性的方法。
1、改变目录和文件属性,禁止写入
find -type f -name \*.php -exec chmod 444 {} \;
find -type d -exec chmod 555 {} \;
注:当然要排除上传目录、缓存目录等;
同时最好禁止chmod函数,攻击者可通过chmod来修改文件只读属性再修改文件
2、php的危险配置
禁用一些危险的php函数,例如:
passthru,exec,system,chroot,scandir,chgrp,chown,shell_exec,proc_open,proc_get_status,ini_alter,
ini_alter,ini_restore,dl,openlog,syslog,readlink,symlink,popepassthru,stream_socket_server,escapeshellcmd,popen,dl,
syslog,show_source
3、nginx安全方面的配置
限制一些目录执行php文件
location~^/images/.*\.(php|php5)$
{
denyall;
}
location~^/static/.*\.(php|php5)$
{
denyall;
}
location~*^/data/(attachment|avatar)/.*\.(php|php5)$
{
denyall;
}
注:这些目录的限制必须写在
location~.*\.(php|php5)$
{
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
include fcgi.conf;
}
的前面,否则限制不生效!
path_info漏洞修正:
在通用fcgi.conf顶部加入
if ($request_filename ~* (.*)\.php) {
set $php_url $1;
}
if (!-e $php_url.php) {
return 404;
}
4、linux系统下查找php的相关木马
php木马一般含有<?php eval($_POST[cmd]);?>或者<?php assert($_POST[cmd]);?>
find /data/wwwroot/* -type f -name "*.php" |xargs grep "eval(" > /root/scan.txt
另外也有上传任意文件的后门,可以用上面的方法查找所有包括"move_uploaded_file"的文件.
还有常见的一句话后门:
grep -r --include=*.php '[^a-z]eval($_POST' . > grep.txt
grep -r --include=*.php 'file_put_contents(.*$_POST\[.*\]);' . > grep.txt
把搜索结果写入文件,下载下来慢慢分析,其他特征木马、后门类似。有必要的话可对全站所有文件来一次特征查找,上传图片肯定有也捆绑的,来次大清洗。
5、查找近3天被修改过的文件:
find /data/www -mtime -3 -type f -name \*.php
注意:攻击者可能会通过touch函数来修改文件时间属性来避过这种查找,所以touch必须禁止
6、查找所有图片文件
查找所有图片文件gif,jpg.有些图片内容里被添加了php后门脚本.有些实际是一个php文件,将扩展名改成了gif了.正常查看的情况下也可以看到显示的图片内容的.这一点很难发现.
曾给客户处理过这类的木马后门的.发现在php脚本里include一个图片文件,经过查看图片文件源代码,发现竟然是php脚本.
好了。安全加固你的php环境是非常重要的运维工作,大家还有什么其他加固安全的好方法,可以拿过来分享一下。
提示:如果上面显示空白或者页面排版混乱、内容显示不完整等影响阅读的问题,请点击这儿浏览原文
返回脚本百事通首页 如果您喜欢脚本编程技术,欢迎加入QQ群:246889341,在群里认识新朋友和交流技术^_^
Linux下查找后门程序
每个进程都会有一个PID,而每一个PID都会在/proc目录下有一个相应的目录,这是Linux(当前内核2.6)系统的实现。
一般后门程序,在ps等进程查看工具里找不到,因为这些常用工具甚至系统库在系统被入侵之后基本上已经被动过手脚(网上流传着大量的rootkit。假如是内核级的木马,那么该方法就无效了)。
因为修改系统内核相对复杂(假如内核被修改过,或者是内核级的木马,就更难发现了),所以在/proc下,基本上还都可以找到木马的痕迹。
思路:
在/proc中存在的进程ID,在 ps 中查看不到(被隐藏),必有问题。
Bash Shell:
#!/bin/bash
str_pids="`ps -A | awk '{print $1}'`"
for i in /proc/[[:digit:]]*; do
if echo "$str_pids" | grep -qs `basename "$i"`; then
:
else
echo "Rootkit's PID: $(basename "$i")"
fi
done
讨论:
检查系统(Linux)是不是被黑,其复杂程度主要取决于入侵者“扫尾工作”是否做得充足。对于一次做足功课的入侵来说,要想剔除干净,将是一件分精密、痛苦的事情,通常这种情况,需要用专业的第三方的工具(有开源的,比如tripwire,比如aide)来做这件事情。
而专业的工具,部署、使用相对比较麻烦,也并非所有的管理员都能熟练使用。
实际上Linux系统本身已经提供了一套“校验”机制,在检查系统上的程序没有被修改。比如rpm包管理系统提供的 -V 功能:
rpm -Va
即可校验系统上所有的包,输出与安装时被修改过的文件及相关信息。但是rpm系统也可能被破坏了,比如被修改过。
aide获取网页开源的代码为什么不能截取字符cut.php:
#!/usr/bin/php
<?php
define('INPUT_FILE', 't.txt');
define('OUTPUT_FILE', 'a.txt');
$pos = max(intval($argv[1]), 0);
$len = max(intval($argv[2]), 0);
$file_size = filesize(INPUT_FILE);
if($pos >= $file_size) exit;
$fp = fopen(INPUT_FILE, 'rb');
$point = 0; //current byte position
$string = '';
while(ftell($fp) < $file_size) {
if($point >= $pos + $len) break;$byte = fread($fp, 1);
//php version >= 5.4
$char = unpack('C', $byte)[1];
if($char <= 0x7f) {
//single byte
if($point >= $pos) $string .= $byte;
$point += 1;
continue;
} else {
//double bytes
if($point >= $pos) {
$string .= $byte.fread($fp, 1);
} else {
fseek($fp, 1, SEEK_CUR);
}
$point += 1;
continue;
}
}
fclose($fp);
file_put_contents(OUTPUT_FILE, $string);
?>
复制代码
源文件t.txt内容:
dkei20王nnso
测试命令:
./cut.php 6 1
查看结果:
hexdump -C t.txt hexdump -C a.txt
以上这篇php 截取GBK文档某个位置开始的n个字符方法就是小编分享给大家的全部内容了,希望能给大家一个参考,也希望大家多多支持程序员之家。
您可能感兴趣的文章:
php字符串截取问题
php截取字符串之截取utf8或gbk编码的中英文字符串示例
php截取字符串函数分享
php 在字符串指定位置插入新字符的简单实现
详解PHP用substr函数截取字符串中的某部分
自学编程的软件自学编程建议找专业机构达内教育进行系统化学习,软件有C/C++,Java,Python,前端网页,Linux。
C++编译器(c4droid),可以直接编辑运行C/C++程序,代码高亮、语法检查,使用起来非常不错。
AIDE,可以直接编译运行Java代码,同时还可以编写简单的安卓程序,支持自动补全、代码高亮、语法提示等功能,使用起来也非常不错。
Python集成了Python3解释器,既可以命令行运行Python,还可以编辑源文件后运行,支持代码高亮、语法检查等功能。
前端网页这里可以使用一个软件—w3cschool编程学院,类似一个编程资料库,提供的免费教程很多,其实不仅仅限于前端Html,CSS,Js等,还有Python,PHP,C++等后端资料,对于入门编程的新手来说,是一个非常不错的学习软件。
Linux这里可以使用一个软件—Termux,一个高级终端,类似手机的Linux,支持bash,zsh,可以远程登录Linux服务器,还可以编写运行Python,C/C++等程序。
想了解更多有关【编程软件的详情】,推荐咨询达内教育。达内教育独创TTS8.0教学系统,达内OMO教学模式,全新升级,线上线下交互学习,满足学生多样化学习需求;同时,拥有经验丰富的讲师进行课程的讲授,对标企业人才标准,制定专业学习计划,囊括主流热点技术,运用理论知识+学习思维+实战操作,打造完整学习闭环;更有企业双选会,让学生就业更顺利。【感兴趣的话点击此处,免费学习一下】
如何RecursiveIteratorIterator在PHP中工作Some speed tests
<?php
$timer = function ($name = 'default', $unset_timer = TRUE)
{
static $timers = array();
if ( isset( $timers[ $name ] ) )
{
list($s_sec, $s_mic) = explode(' ', $timers[ $name ]);
list($e_sec, $e_mic) = explode(' ', microtime());
if ( $unset_timer )
unset( $timers[ $name ] );
return $e_sec - $s_sec + ( $e_mic - $s_mic );
}
$timers[ $name ] = microtime();
};
function f1 ($array) {
$iterator = new RecursiveIteratorIterator(new RecursiveArrayIterator($array), RecursiveIteratorIterator::SELF_FIRST);
foreach ( $iterator as $key => $value ) {
if ( is_array($value) )
continue;
}
}
function f2($array) {
foreach ( $array as $key => $value ) {
if ( is_array($value) )
f2($value);
}
}
foreach ( [100, 1000, 10000, 100000, 1000000] as $num )
{
$array = [];
for ( $i = 0; ++$i < $num; )
$array[] = [1,2,3=>[4,5,6=>[7,8,9=>10,11,12=>[13,14,15=>[16,17,18]]]]];
$timer();
f1($array);
printf("RecursiveIteratorIterator: %7d elements -> %.3f sec\n", $num, $timer());
$timer();
f2($array);
printf("Recursive function : %7d elements -> %.3f sec\n", $num, $timer());
}
?>
Output (PHP 5.4.9-4ubuntu2.1 (cli) (built: Jun 11 2013 13:10:01))
=======================
RecursiveIteratorIterator: 100 elements -> 0.007 sec
Recursive function : 100 elements -> 0.002 sec
RecursiveIteratorIterator: 1000 elements -> 0.036 sec
Recursive function : 1000 elements -> 0.024 sec
RecursiveIteratorIterator: 10000 elements -> 0.425 sec
Recursive function : 10000 elements -> 0.263 sec
RecursiveIteratorIterator: 100000 elements -> 8.153 sec
Recursive function : 100000 elements -> 2.654 sec
RecursiveIteratorIterator: 1000000 elements -> 474.483 sec
Recursive function : 1000000 elements -> 26.872 sec
For one million elements recursive function is more quickly!
up
down
7 Adil Baig @ AIdezigns ¶5 years ago
A very important thing to note about \RecursiveIteratorIterator is that it returns a flattened array when used with the iterator_to_array function. Ex:
<?php
$arr = array('Zero', 'name'=>'Adil', 'address' => array( 'city'=>'Dubai', 'tel' => array('int' => 971, 'tel'=>12345487)), '' => 'nothing');
$iterator = new \RecursiveIteratorIterator(new \RecursiveArrayIterator($arr));
var_dump(iterator_to_array($iterator,true));
?>
This code will return :
array(6) {
[0]=>
string(4) "Zero"
["name"]=>
string(4) "Adil"
["city"]=>
string(5) "Dubai"
["int"]=>
int(91)
["tel"]=>
int(12345487)
[""]=>
string(7) "nothing"
}
To get the non-flattened proper array use the getArrayCopy() method, like so :
$iterator->getArrayCopy()
This will return
array(4) {
[0]=>
string(4) "Zero"
["name"]=>
string(4) "Adil"
["address"]=>
array(2) {
["city"]=>
string(5) "Dubai"
["tel"]=>
array(2) {
["int"]=>
int(91)
["tel"]=>
int(12345487)
}
}
[""]=>
string(7) "nothing"
}
up
down
6 aidan at php dot net ¶6 years ago
This example demonstrates using the getDepth() method with a RecursiveArrayIterator.
<?php
$tree = array();
$tree[1][2][3] = 'lemon';
$tree[1][4] = 'melon';
$tree[2][3] = 'orange';
$tree[2][5] = 'grape';
$tree[3] = 'pineapple';
print_r($tree);
$arrayiter = new RecursiveArrayIterator($tree);
$iteriter = new RecursiveIteratorIterator($arrayiter);
foreach ($iteriter as $key => $value) {
$d = $iteriter->getDepth();
echo "depth=$d k=$key v=$value\n";
}
?>
The output of this would be:
Array
(
[1] => Array
(
[2] => Array
(
[3] => lemon
)
[4] => melon
)
[2] => Array
(
[3] => orange
[5] => grape
)
[3] => pineapple
)
depth=2 k=3 v=lemon
depth=1 k=4 v=melon
depth=1 k=3 v=orange
depth=1 k=5 v=grape
depth=0 k=3 v=pineapple
up
down
4 fengdingbo at gmail dot com ¶3 years ago
if you want traversal directory。
<?php
foreach (new RecursiveIteratorIterator(new RecursiveDirectoryIterator("./")) as $key=>$val)
{
echo $key,"=>",$val,"\n";
}
?>
up
down
8 Michiel Brandenburg ¶7 years ago
You can use this to quickly find all the files (recursively) in a certain directory. This beats maintaining a stack yourself.
<?php
$directory = "/tmp/";
$fileSPLObjects = new RecursiveIteratorIterator(
new RecursiveDirectoryIterator($directory),
RecursiveIteratorIterator::CHILD_FIRST
);
try {
foreach( $fileSPLObjects as $fullFileName => $fileSPLObject ) {
print $fullFileName . " " . $fileSPLObject->getFilename() . "\n";
}
}
catch (UnexpectedValueException $e) {
printf("Directory [%s] contained a directory we can not recurse into", $directory);
}
?>
Note: if there is a directory contained within the directory you are searching in that you have no access to read an UnexpectedValueException will be thrown (leaving you with an empty list).
Note: objects returned are SPLFileObjects
up
down
1 gerry at king-foo dot be ¶2 years ago
Carefull when using iterator_to_array(). Because it flattens down your subiterators, elements with the same keys will overwrite eachother.
For example:
<?php
$iterator = new RecursiveIteratorIterator(
new RecursiveArrayIterator([
['foo', 'bar'],
['baz', 'qux']
])
);
foreach ($iterator as $element) {
echo $element;
}
?>
This will output all 4 elements as expected:
string(3) "foo"
string(3) "bar"
string(3) "baz"
string(3) "qux"
While doing:
<?php
var_dump(iterator_to_array($iterator));
?>
will output an array with only the last 2 elements:
array(2) {
[0]=>
string(3) "baz"
[1]=>
string(3) "qux"
}
关于aidephp的介绍到此就结束了,不知道本篇文章是否对您有帮助呢?如果你还想了解更多此类信息,记得收藏关注本站,我们会不定期更新哦。