l1n6yun's Blog

记录学习的技能和遇到的问题

0%

为什么要做信息搜集

在渗透测试中,就好比和人打架,你不知道对方的身高、体型、力气有多大。所以再打架前就要通过一些手段,来收集到对方的信息,搜集到的越多越好。

使用curl命令

通过 curl 命令添加 --head 参数来获取相应头,从响应头来判断操作系统

1
2
3
4
5
6
7
8
9
10
11
12
13
┌──(kali㉿kali)-[~/Tools/w3af]
└─$ curl --head http://192.168.0.102
HTTP/1.1 200 OK
Content-Length: 1193
Content-Type: text/html
Content-Location: http://192.168.0.102/iisstart.htm
Last-Modified: Fri, 21 Feb 2003 12:15:52 GMT
Accept-Ranges: bytes
ETag: "0ce1f9a2d9c21:242"
Server: Microsoft-IIS/6.0
MicrosoftOfficeWebServer: 5.0_Pub
X-Powered-By: ASP.NET
Date: Mon, 03 Oct 2022 14:29:35 GMT

IIS 版本和操作系统对应表

IIS Version Windows Server Version
IIS 5.0 Windows 2000
IIS 5.1 Windows XP
IIS 6.0 Windows 2003
IIS 7.0 Windows 2008、Windows Vista
IIS 7.5 Windows 2008 R2、Windows 7

使用 nmap 命令

查看服务版本

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
┌──(kali㉿kali)-[~]
└─$ nmap 192.168.0.102 -p 80 -A
Starting Nmap 7.92 ( https://nmap.org ) at 2022-10-03 09:42 EDT
Nmap scan report for 192.168.0.102 (192.168.0.102)
Host is up (0.00056s latency).

PORT STATE SERVICE VERSION
80/tcp open http Microsoft IIS httpd 6.0
|_http-title: \xBD\xA8\xC9\xE8\xD6\xD0
| http-methods:
|_ Potentially risky methods: TRACE
|_http-server-header: Microsoft-IIS/6.0
Service Info: OS: Windows; CPE: cpe:/o:microsoft:windows

Service detection performed. Please report any incorrect results at https://nmap.org/submit/ .
Nmap done: 1 IP address (1 host up) scanned in 6.39 seconds

-p <port ranges>: Only scan specified ports

-A: Enable OS detection, version detection, script scanning, and traceroute

查看操作版本信息

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
──(kali㉿kali)-[~]
└─$ sudo nmap 192.168.0.102 -O
[sudo] password for kali:
Starting Nmap 7.92 ( https://nmap.org ) at 2022-10-03 09:42 EDT
Nmap scan report for 192.168.0.102 (192.168.0.102)
Host is up (0.00033s latency).
Not shown: 994 closed tcp ports (reset)
PORT STATE SERVICE
80/tcp open http
135/tcp open msrpc
139/tcp open netbios-ssn
445/tcp open microsoft-ds
1025/tcp open NFS-or-IIS
1046/tcp open wfremotertm
MAC Address: 00:0C:29:86:F6:23 (VMware)
Device type: general purpose
Running: Microsoft Windows XP|2003
OS CPE: cpe:/o:microsoft:windows_xp::sp2 cpe:/o:microsoft:windows_server_2003::sp1 cpe:/o:microsoft:windows_server_2003::sp2
OS details: Microsoft Windows XP SP2 or Windows Server 2003 SP1 or SP2
Network Distance: 1 hop

OS detection performed. Please report any incorrect results at https://nmap.org/submit/ .
Nmap done: 1 IP address (1 host up) scanned in 2.46 seconds

OS DETECTION:
-O: Enable OS detection
–osscan-limit: Limit OS detection to promising targets
–osscan-guess: Guess OS more aggressively

这是一个强健的 Javascript 库用于捕获键盘输入和输入的组合键,它没有依赖,压缩只有(~3kb),gzip:1.9k。官方文档DEMO预览更多实例.

1
2
3
4
5
╭┈┈╮          ╭┈┈╮  ╭┈┈╮
┆ ├┈┈..┈┈┈┈┈.┆ └┈╮┆ ├┈┈..┈┈┈┈┈..┈┈.┈┈..┈┈┈┈┈.
┆ ┆┆ □ ┆┆ ┈┤┆ < ┆ -__┘┆ ┆ ┆┆__ ┈┈┤
╰┈┈┴┈┈╯╰┈┈┈┈┈╯╰┈┈┈┈╯╰┈┈┴┈┈╯╰┈┈┈┈┈╯╰┈┈┈ ┆╰┈┈┈┈┈╯
╰┈┈┈┈┈╯

创建

您将需要在您的系统上安装的 Node.js。

1
2
3
4
5
6
7
8
# bower 安装
$ bower install hotkeysjs

# npm 安装
$ npm install hotkeys-js

$ npm run build # 编译
$ npm run watch # 开发模式
1
2
3
4
5
6
7
import hotkeys from 'hotkeys-js';

hotkeys('f5', function(event, handler){
// Prevent the default refresh event under WINDOWS system
event.preventDefault()
alert('you pressed F5!')
});

或者在您的HTML中手动下载并引入 hotkeys.js,你也可以通过 UNPKG 进行下载:

1
2
3
4
5
6
7
8
9
10
11
<script src="https://unpkg.com/hotkeys-js/dist/hotkeys.min.js"></script>
<script type="text/javascript">
hotkeys('ctrl+a,ctrl+b,r,f', function(event,handler) {
switch(handler.key){
case "ctrl+a":alert('you pressed ctrl+a!');break;
case "ctrl+b":alert('you pressed ctrl+b!');break;
case "r":alert('you pressed r!');break;
case "f":alert('you pressed f!');break;
}
});
</script>

React中使用

react-hotkeys,安装如下:

1
npm i -S react-hot-keys

详细使用方法请参考文档 react-hotkeys

使用

传统调用

1
<script type="text/javascript" src="./js/hotkeys.js"></script>

包加载

1
2
3
4
5
6
7
8
import hotkeys from 'hotkeys-js';

hotkeys('shift+a,alt+d, w', function(e){
console.log('干点活儿',e);
if(hotkeys.shift) console.log('大哥你摁下了 shift 键!');
if(hotkeys.ctrl) console.log('大哥你摁下了 ctrl 键!');
if(hotkeys.alt) console.log('大哥你摁下了 alt 键!');
});

支持的键

, shift, option, , alt, ctrl, control, command,

Command()
Control
Option(alt)
Shift
Caps Lock(大写)
fn 功能键就是fn(不支持)
↩︎ return/enter
space 空格键

修饰键判断

可以对下面的修饰键判断 shift alt option ctrl control command,特别注意+=键值相同,组合键设置⌘+=

1
2
3
4
5
6
7
8
9
10
hotkeys('shift+a,alt+d, w', function(e){
console.log('干点活儿',e);
if(hotkeys.shift) console.log('您摁下了 shift 键!');
if(hotkeys.ctrl) console.log('您摁下了 ctrl 键!');
if(hotkeys.alt) console.log('您摁下了 alt 键!');
if(hotkeys.option) console.log('您摁下了 option 键!');
if(hotkeys.control) console.log('您摁下了 control 键!');
if(hotkeys.cmd) console.log('您摁下了 cmd 键!');
if(hotkeys.command) console.log('您摁下了 command 键!');
});

定义快捷键

hotkeys([keys:<String>], [option:[string|object|function]], [callback:<function>])

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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
// 定义 F5 快捷键
hotkeys('f5', function(event,handler){
//event.srcElement: input
//event.target: input
// 阻止WINDOWS系统下的默认刷新事件
event.preventDefault()
alert('你按下了 F5 键!')
});
// 返回 false 将停止活动,并阻止默认浏览器事件
// Mac OS 系统 定义 `command+r` 为刷新快捷键
hotkeys('ctrl+r, command+r', function(){
alert('停止刷新!');
return false;
});

// 定义a快捷键
hotkeys('a', function(event,handler){
//event.srcElement: input
//event.target: input
if(event.target === "input"){
alert('你在输入框中按下了 a!')
}
alert('你按下了 a!')
});

// 定义 ctrl+a、ctrl+b、r、f 四组快捷键
hotkeys('ctrl+a,ctrl+b,r,f', function(event,handler){
switch(handler.key){
case "ctrl+a": alert('你按下了ctrl+a!'); break;
case "ctrl+b": alert('你按下了ctrl+b!'); break;
case "r": alert('你按下了r!'); break;
case "f": alert('你按下了f!'); break;
}
//handler.scope 范围
});


// 多个快捷方式做同样的事情
hotkeys('⌘+r, ctrl+r', function(){ });

// 对所有摁键执行任务
hotkeys('*','wcj', function(e){
console.log('干点活儿',e);
console.log("key.getScope()::",hotkeys.getScope());
if(hotkeys.shift) console.log('大哥你摁下了 shift 键!');
if(hotkeys.ctrl) console.log('大哥你摁下了 ctrl 键!');
if(hotkeys.alt) console.log('大哥你摁下了 alt 键!');
});

// 可以设置自定义的分割符
hotkeys('ctrl-y, ctrl-a', {splitKey: '-'}, function(e){
console.log('you press bind keys')
})

option

  • scope<String>
  • element<HTMLElement>
  • keyup<Boolean>
  • keydown<Boolean>
1
2
3
4
5
6
hotkeys('o, enter', {
scope: 'wcj',
element: document.getElementById('warpper'),
}, function(){
console.log('do something else');
});

切换快捷键

如果在单页面在不同的区域,相同的快捷键,干不同的事儿,之间来回切换。O(∩_∩)O !

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
// 一个快捷键,有可能干的活儿不一样哦
hotkeys('ctrl+o, ctrl+alt+enter', 'scope1', function(){
console.log('你好看');
});

hotkeys('ctrl+o, enter', 'scope2', function(){
console.log('你好丑陋啊!');
});

// 你摁 “ctrl+o”组合键
// 当scope等于 scope1 ,执行 回调事件打印出 “你好看”,
// 当scope等于 scope2 ,执行 回调事件打印出 “你好丑陋啊!”,

// 通过setScope设定范围scope
hotkeys.setScope('scope1'); // 默认所有事儿都干哦

标记快捷键范围

删除 区域范围标记

1
hotkeys.deleteScope('scope1');

获取 区域范围标记

1
hotkeys.getScope();

设置 区域范围标记

1
hotkeys.setScope('scope1');

解除绑定

hotkeys.unbind() 解除绑定的所有快捷键
hotkeys.unbind("ctrl+o, ctrl+alt+enter") 解除绑定两组快捷键
hotkeys.unbind("ctrl+o","files") 解除绑定名字叫files钟的一组快捷键

1
2
3
4
5
6
7
// 解除绑定 'a' 程序函数
hotkeys.unbind('a');

// 仅针对单个范围解除绑定快捷键
// 如果未指定范围,则默认为当前范围(hotkeys.getScope())
hotkeys.unbind('o, enter', 'issues');
hotkeys.unbind('o, enter', 'files');

通过函数来解除绑定

1
2
3
4
5
6
function example(){}
hotkeys('a', example);
hotkeys.unbind('a', example);

hotkeys('a', 'issues', example);
hotkeys.unbind('a', 'issues', example);
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
可以通过传入对象解除绑定的快捷键
hotkeys.unbind({
key: 'ctrl-e,ctrl-u',
scope: 'issues',
spitKey: '-'
})
传入数组可同时解除多个scope下绑定的快捷键
hotkeys.unbind([
{
key: 'a, ctrl+r',
scope: 'issues',
},
{
key: '+, ctrl-y',
scope: 'test',
splitKey: '-'
}
])

键判断

判断摁下的键是否为某个键

1
2
3
4
5
hotkeys('a', function(){
console.log(hotkeys.isPressed("a")); //=> true
console.log(hotkeys.isPressed("A")); //=> true
console.log(hotkeys.isPressed(65)); //=> true
});

获取摁下键值

获取摁下绑定键的键值 hotkeys.getPressedKeyCodes()

1
2
3
hotkeys('command+ctrl+shift+a,f', function(){
console.log(hotkeys.getPressedKeyCodes()); //=> [17, 65] 或者 [70]
})

keyup

key downkey up 将都执行回调事件。

1
2
3
4
5
6
7
8
hotkeys('ctrl+a,alt+a+s', { keyup: true }, (evn, handler) => {
if(evn.type === 'keydown') {
console.log('keydown:', evn.type, handler, handler.key);
}
if(evn.type === 'keyup') {
console.log('keyup:', evn.type, handler, handler.key);
}
});

过滤

INPUT SELECT TEXTAREA 默认不处理。
hotkeys.filter 返回 true 快捷键设置才会起作用,false 快捷键设置失效。

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
hotkeys.filter = function(event){
return true;
}
// 如何增加过滤可编辑标签 <div contentEditable="true"></div>
// contentEditable老浏览器不支持滴
hotkeys.filter = function(event) {
var tagName = (event.target || event.srcElement).tagName;
return !(tagName.isContentEditable ||
tagName == 'INPUT' ||
tagName == 'SELECT' ||
tagName == 'TEXTAREA');
}

//
hotkeys.filter = function(event){
var tagName = (event.target || event.srcElement).tagName;
hotkeys.setScope(/^(INPUT|TEXTAREA|SELECT)$/.test(tagName) ? 'input' : 'other');
return true;
}

兼容模式

1
2
3
4
5
6
7
8
9
10
var k = hotkeys.noConflict();
k('a', function() {
console.log("这里可以干一些事儿")
});

hotkeys()
// -->Uncaught TypeError: hotkeys is not a function(anonymous function)
// @ VM2170:2InjectedScript._evaluateOn
// @ VM2165:883InjectedScript._evaluateAndWrap
// @ VM2165:816InjectedScript.evaluate @ VM2165:682

开发

安装依赖,运行自重载构建,获取代码:

1
2
3
$ git https://github.com/jaywcjlove/hotkeys.git
$ cd hotkeys # 进入目录
$ npm install # 或者使用 yarn install 安装依赖

运行下面命令自动重载构建:

1
$ npm run watch

运行稳定环境

1
$ npm run doc:dev

如果要贡献,请 fork Hotkeys.js, 并添加您的测试代码(在 test 目录中),并提交一个 PR。

1
2
$ npm run test
$ npm run test:watch # Development model

License

MIT © Kenny Wong

route.php 文件

1
2
3
return array (
'l1n6yun$' => 'admin/Index/index',
);

``app\admin\controller\AdminBaseController` 类

1
2
3
4
5
6
7
8
9
10
11
12
protected function initialize()
{
parent::initialize();

// 获取登陆session
$sessionAdminId = session('ADMIN_ID');

// 如果没有登陆跳转到登陆页面
if (empty($sessionAdminId)) {
return $this->redirect(url("admin/Public/login"));
}
}

app\admin\controller\IndexController

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
public function initialize()
{
// 后台设置
$adminSettings = cmf_get_option('admin_settings');

// $adminSettings['admin_password'] = "l1n6yun" 后台加密地址
if (empty($adminSettings['admin_password']) || $this->request->path() == $adminSettings['admin_password']) {
$adminId = cmf_get_current_admin_id();
if (empty($adminId)) {
session("__LOGIN_BY_CMF_ADMIN_PW__", 1);//设置后台登录加密码
}
}

parent::initialize();
}

app\admin\controller\PublicController

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
32
33
34
35
36
37
38
39
40
41
42
43
class PublicController extends AdminBaseController
{
public function initialize()
{
}

public function login()
{
// 设置后台登录加密码
$loginAllowed = session("__LOGIN_BY_CMF_ADMIN_PW__");
if (empty($loginAllowed)) {
return redirect(cmf_get_root() . "/");
}

session("__SP_ADMIN_LOGIN_PAGE_SHOWED_SUCCESS__", true);
return $this->fetch(":login");
}

public function doLogin()
{
// 判断登录页面是否显示成功
$loginAllowed = session("__SP_ADMIN_LOGIN_PAGE_SHOWED_SUCCESS__");
if (empty($loginAllowed)) {
$this->error('非法登录!', cmf_get_root() . '/');
}

/**
* 登陆逻辑 ...
*/

// 登陆成功
if($result)
{
session('ADMIN_ID', $result["id"]);
session('name', $result["user_login"]);

session("__LOGIN_BY_CMF_ADMIN_PW__", null);
session("__SP_ADMIN_LOGIN_PAGE_SHOWED_SUCCESS__", null);

$this->success(lang('LOGIN_SUCCESS'), url("admin/Index/index"));
}
}
}

目的:渗透测试和安全审计中需要kali linux的系统时间与实际时间同步。

命令:sudo timedatectl set-timezone "Asia/Shanghai"

使用命令 timedatectl 查看当前时区等信息

简介

Kali Linux is a Debian-derived Linux distribution designed for digital forensics and penetration testing. It is maintained and funded by Offensive Security Ltd

下载地址: https://mirrors.aliyun.com/kali/

相关仓库

配置方法

修改 /etc/apt/sources.list , 将相关 url 改成阿里云的源。

1
2
#deb https://mirrors.aliyun.com/kali kali-rolling main non-free contrib
#deb-src https://mirrors.aliyun.com/kali kali-rolling main non-free contrib

相关链接

  1. 生成公钥

    1
    2
    sudo -Hu www ssh-keygen -t rsa
    sudo cat /var/www/.ssh/id_rsa.pub
  2. 修改GIT配置

    1
    2
    sudo -Hu www git config --global user.name "l1n6yun"
    sudo -Hu www git config --global user.email "l1n6yun@gmail.com"
  3. 初始化仓库

    1
    sudo -Hu www git clone git@github.com:you/project.git /www/wwwroot/project --depth=1
  4. 添加钩子文件

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    error_reporting(1);

    $target = '/www/wwwroot/project';
    $token = 'Your hook token';

    $json = json_decode(file_get_contents('php://input'), true);

    if (empty($json['token']) || $json['token'] !== $token) {
    exit('error request');
    }

    $cmd = "sudo -Hu www cd $target && git pull";
    shell_exec($cmd);
  5. 在托管平台上添加 hook

  6. 测试

    1
    2
    git commit -am "test hook" --allow-empty
    git push

    OK,稍微一几秒,正常的话你在代码里配置的目标目录里就会有你的项目文件了。

字体修改软件 - noMeiryoUI

noMeiryoUI 官方版是Windows 7/8/8.1/10中画面的各部分的字体设定工具。
何故Windows 7/8/8.1/10上标准的画面的各部分的字体的设定是不行的事,所以作成了这个。
软件只是对主题字体风格设置进行修改,而不是对系统字体本身的渲染、修改,所以无风险,无占用。
软件可以修改不同的字体,辅助 win 10 第三方主题文件应用字体。

字体渲染软件 - MacType

MacType 是一个开源项目,能接管Windows系统的 GDI 字体渲染功能,实现比Mac系统更华丽的字体渲染效果! MacType 支持 WinXP 、Win7 、Win8 、Win10 等操作系统。安装过程十分简单,到最后,它才会让我们在四种加载方式之间进行选择,对于一般用户来说,最好选择 MacTray 方式加载( MacTray 也有两种方式,建议采用独立加载模式)。这种方式会在系统托盘中显示一个控制图标,方便配置。

开始菜单程序 - StartIsBack

StartIsBack 是一款 Win8 和 Win10 开始菜单辅助工具,可以让 Win8 和 Win10 能够使用跟 Win7 中一样的经典开始菜单,此款软件小巧且不需要繁琐的设置,在同类软件中应该是最好的,推荐大家使用。

个性化桌面定制工具 - Rainmeter

Rainmeter 可以在你的桌面上显示包含内存,电池,RSS,天气等信息的可定制皮肤,许多皮肤还具有一定的功能:它们能帮你记录下你即将要做的事,把你的微博发布出去,控制媒体播放器等。它还能美化你的桌面,你可以完全按照自己的意愿去定制一款你想要皮肤,让你的桌面与众不同。 Rainmeter 是一款能够发挥你想象力和创新力的工具.

资源管理器调整工具 - OldNewExplorer

OldNewExplorer 是一款资源管理器调整工具,可以在系统中调整资源管理器的软件,使用这款软件用户可以隐藏“这台电脑”中的菜单,按钮或文件夹。

上周,我分享了如何使用BEM创建一个合理的CSS架构。 虽然BEM很棒,但它只是解决方案的一部分。 还有另一部分我还没有提到 —— 命名空间。

阅读全文 »

你是否做过多页面的大型网站或者其中一部分?如果你做过,你可能会意识到 CSS 架构不够强大所带来的恐惧。你可能还会研究如何编写可维护的 CSS。

阅读全文 »