Skip to content

Commit b8cf846

Browse files
committed
增加代码编辑框
1 parent d96f03e commit b8cf846

File tree

12 files changed

+211
-12
lines changed

12 files changed

+211
-12
lines changed

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
1-
/dist
1+
/dist
2+
/web

README.md

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
# php.porttable.debug
2+
3+
#### 介绍
4+
5+
PHP代码本地调试工具,版本号为5.2.17,可作为CTF web辅助工具,例如php反序列化
6+
7+
注意:编辑框组建依赖webview2
8+
9+
#### 下载
10+
11+
参考release文件,也可下载aardio手动编译
12+
13+
#### 编译
14+
15+
使用webstorm(推荐)打开web.src目录
16+
17+
npm install 下载依赖包
18+
19+
npm build 执行webpack打包输出到web目录
20+
21+
aardio IDE打开项目
22+
23+
#### 软件截图
24+
25+
![image](https://github.com/sfantree/php.porttable.debug/blob/master/img/1.jpg)
26+

default.aproj

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
<?xml version="1.0" encoding="utf-8"?>
2-
<project ver="34" name="php.porttable.debug" libEmbed="true" icon="..." ui="win" output="php.porttable.debug.exe" CompanyName="单位名称" FileDescription="php.porttable.debug" LegalCopyright="Copyright (C) 作者 2022" ProductName="php.porttable.debug" InternalName="php.porttable.debug" FileVersion="0.0.0.1" ProductVersion="0.0.0.1" publishDir="/dist/" dstrip="false">
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<project ver="10" name="php.porttable.debug" libEmbed="true" icon="..." ui="win" output="php.porttable.debug.exe" CompanyName="单位名称" FileDescription="php.porttable.debug" LegalCopyright="Copyright (C) 作者 2022" ProductName="php.porttable.debug" InternalName="php.porttable.debug" FileVersion="0.0.0.1" ProductVersion="0.0.0.1" publishDir="/dist/" dstrip="false" local="false" ignored="false">
33
<file name="main.aardio" path="main.aardio" comment="main.aardio"/>
4-
<folder name="资源文件" path="res" embed="true"/>
5-
<folder name="窗体文件" path="dlg" comment="目录" embed="true"/>
4+
<folder name="资源文件" path="res" embed="true" local="false" ignored="false"/>
5+
<folder name="窗体文件" path="dlg" comment="目录" embed="true" local="false" ignored="false"/>
66
</project>

img/1.jpg

84.6 KB
Loading

main.aardio

Lines changed: 46 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,19 +3,32 @@
33
// @File : phpruncode.aardio
44
// @Comment : PHP代码调试助手 (≡^∇^≡)
55

6+
/*
7+
2022年5月2日23:13:47 修改编辑器为microsoft/monaco-editor
8+
*/
9+
610
import win.ui;
711
/*DSG{{*/
8-
var winform = win.form(text='PHP代码调试助手 (\u2261^\u2207^\u2261)';right=759;bottom=469)
12+
var winform = win.form(text='PHP代码调试助手 (\u2261^\u2207^\u2261)';right=863;bottom=615)
913
winform.add(
10-
button={cls="button";text="运行代码";left=632;top=0;right=760;bottom=40;z=2};
11-
button2={cls="button";text="清空日志";left=632;top=40;right=760;bottom=80;z=4};
12-
edit={cls="edit";left=0;top=0;right=632;bottom=304;autohscroll=false;edge=1;font=LOGFONT(h=-16;name='Consolas');multiline=1;vscroll=1;z=1};
13-
edit2={cls="edit";left=0;top=304;right=760;bottom=472;edge=1;font=LOGFONT(h=-13);multiline=1;z=3}
14+
button={cls="button";text="运行代码";left=736;top=0;right=864;bottom=40;z=1};
15+
button2={cls="button";text="清空日志";left=736;top=40;right=864;bottom=80;z=3};
16+
button3={cls="button";text="关于";left=736;top=120;right=864;bottom=160;z=4};
17+
button4={cls="button";text="刷新";left=736;top=80;right=864;bottom=120;z=6};
18+
custom={cls="custom";text="自定义控件";left=0;top=0;right=736;bottom=456;z=5};
19+
edit2={cls="edit";left=0;top=456;right=864;bottom=616;edge=1;multiline=1;z=2}
1420
)
1521
/*}}*/
1622

1723
import php;
1824
import console;
25+
import web.view;
26+
import wsock.tcp.simpleHttpServer;
27+
28+
theView = web.view(winform.custom, ," --disable-site-isolation-trials --disable-web-security");
29+
var url = wsock.tcp.simpleHttpServer.startUrl("\web\index.html");
30+
31+
theView.go(url);
1932

2033
winform.Logd = function(...){
2134
import debug;
@@ -36,7 +49,12 @@ winform.Logd = function(...){
3649
}
3750

3851
winform.button.oncommand = function(id,event){
39-
var code = winform.edit.text;
52+
53+
//var code = winform.edit.text;
54+
var code = theView.xcall("window.editorGetText");
55+
56+
//console.log(code);
57+
4058
if(code and #code > 0) {
4159
winform.code = code;
4260
thread.invoke(
@@ -70,7 +88,9 @@ winform.button2.oncommand = function(id,event){
7088
winform.edit2.text = "";
7189
}
7290

73-
winform.edit.text = /***
91+
//winform.edit.text =
92+
/***
93+
// 对象序列化
7494
class test{
7595
private $flag = "flag{this-is-flag}";
7696
public $a = "snail";
@@ -80,7 +100,26 @@ class test{
80100
$test = new test; //建立一个test的对象;
81101
$data = serialize($test); //将对象进行序列化;
82102
echo $data;
103+
104+
// MD5利用
105+
$_GET['name'] = "QNKCDZO";
106+
$_GET['password'] = "240610708";
107+
echo $_GET['name'] != $_GET['password'];
108+
echo MD5($_GET['name']) == MD5($_GET['password']);
109+
83110
***/
84111

112+
winform.button3.oncommand = function(id,event){
113+
winform.Logd("这是一个可以离线运行PHP代码的工具 可以用作ctf web的调试工具");
114+
winform.Logd("Github: https://github.com/sfantree/php.porttable.debug");
115+
winform.Logd("Contact Me: popy32 Email: 74o5o27o8#qq.com");
116+
}
117+
118+
winform.button4.oncommand = function(id,event){
119+
theView.go(url);
120+
}
121+
122+
123+
85124
winform.show();
86125
win.loopMessage();

web.src/.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
dist/*.js
2+
dist/*.ttf
3+
.idea/*.*

web.src/index.html

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
<!DOCTYPE html>
2+
<html>
3+
<head>
4+
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
5+
</head>
6+
<body>
7+
<div id="container" style="width: 710px; height: 430px; border: 1px solid #ccc"></div>
8+
9+
10+
</body>
11+
</html>
12+

web.src/index.js

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
import * as monaco from 'monaco-editor';
2+
3+
// sample
4+
// https://github.com/microsoft/monaco-editor/blob/main/samples/browser-esm-webpack-small/index.js
5+
import 'monaco-editor/esm/vs/basic-languages/php/php.js';
6+
7+
self.MonacoEnvironment = {
8+
getWorkerUrl: function (moduleId, label) {
9+
// if (label === 'json') {
10+
// return './json.worker.bundle.js';
11+
// }
12+
// if (label === 'css' || label === 'scss' || label === 'less') {
13+
// return './css.worker.bundle.js';
14+
// }
15+
// if (label === 'html' || label === 'handlebars' || label === 'razor') {
16+
// return './html.worker.bundle.js';
17+
// }
18+
// if (label === 'typescript' || label === 'javascript') {
19+
// return './ts.worker.bundle.js';
20+
// }
21+
return './editor.worker.bundle.js';
22+
}
23+
};
24+
25+
window.editormodel = monaco.editor.create(document.getElementById('container'), {
26+
value: [
27+
'class ctfShowUser{',
28+
' public $username=\'xxxxxx\';',
29+
' public $password=\'xxxxxx\';',
30+
' public function checkVip(){',
31+
" return $this->isVip;",
32+
' }',
33+
'}',
34+
'',
35+
'$v = serialize(new ctfShowUser());',
36+
'echo $v;',
37+
'echo urlencode($v);',
38+
].join('\n'),
39+
language: 'php'
40+
});
41+
42+
window.editorGetText = function () {
43+
if(window.editormodel) {
44+
let text = window.editormodel.getValue();
45+
return text;
46+
}
47+
return "";
48+
};
49+
50+
window.editorSetText = function (text) {
51+
if(window.editormodel) {
52+
window.editormodel.setValue(text);
53+
}
54+
};
55+

web.src/npmclean.bat

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
rd /s /q node_modules
2+
rd /s /q dist
3+
rm package-lock.json

web.src/package.json

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
{
2+
"name": "browser-esm-webpack",
3+
"scripts": {
4+
"build": "node ./node_modules/webpack/bin/webpack.js --progress"
5+
},
6+
"author": "Microsoft Corporation",
7+
"license": "MIT",
8+
"devDependencies": {
9+
"css-loader": "^6.6.0",
10+
"file-loader": "^6.2.0",
11+
"html-webpack-plugin": "^5.5.0",
12+
"monaco-editor": "^0.32.1",
13+
"monaco-editor-webpack-plugin": "^7.0.1",
14+
"style-loader": "^3.3.1",
15+
"terser-webpack-plugin": "^5.3.1",
16+
"webpack": "^5.68.0",
17+
"webpack-cli": "^4.9.2",
18+
"webpack-dev-server": "^4.7.4"
19+
}
20+
}

0 commit comments

Comments
 (0)