Skip to content

Commit

Permalink
fix:
Browse files Browse the repository at this point in the history
1、修复hex编辑器显示问题
2、修复yak编辑器滚动条问题
  • Loading branch information
b1rdfree committed Jan 11, 2022
1 parent cccfd6a commit a13ab2b
Show file tree
Hide file tree
Showing 6 changed files with 33 additions and 1 deletion.
5 changes: 5 additions & 0 deletions app/main/handlers/pluginTool.js
Original file line number Diff line number Diff line change
Expand Up @@ -93,4 +93,9 @@ module.exports = (win, getClient) => {
ipcMain.handle("clear-compute-percent", () => {
if (time) clearInterval(time);
});

// 获取操作系统类型
ipcMain.handle("fetch-system-name", () => {
return OS.type();
});
};
2 changes: 1 addition & 1 deletion app/renderer/src/main/prettier.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ module.exports = {
// 末尾不需要逗号
trailingComma: 'none',
// 大括号内的首尾需要空格
bracketSpacing: true,
bracketSpacing: false,
// jsx 标签的反尖括号需要换行
jsxBracketSameLine: false,
// 箭头函数,只有一个参数的时候,也需要括号
Expand Down
10 changes: 10 additions & 0 deletions app/renderer/src/main/src/pages/fuzzer/HTTPFuzzerPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,9 @@ export const HTTPFuzzerPage: React.FC<HTTPFuzzerPageProp> = (props) => {
setRefreshTrigger(!refreshTrigger);
}

// 系统类型
const [system,setSystem]=useState<string>("")

// history
const [history, setHistory] = useState<string[]>([]);
const [currentHistoryIndex, setCurrentHistoryIndex] = useState<number>();
Expand All @@ -135,6 +138,11 @@ export const HTTPFuzzerPage: React.FC<HTTPFuzzerPageProp> = (props) => {
}
};

//获取系统类型
useEffect(()=>{
ipcRenderer.invoke('fetch-system-name').then((res)=>{setSystem(res)})
},[])

useEffect(() => {
if (currentHistoryIndex === undefined) {
return
Expand Down Expand Up @@ -268,6 +276,7 @@ export const HTTPFuzzerPage: React.FC<HTTPFuzzerPageProp> = (props) => {

const responseViewer = (rsp: FuzzerResponse) => {
return <HTTPPacketEditor
system={system}
simpleMode={viewMode === "request"}
originValue={rsp.ResponseRaw}
bordered={true} hideSearch={true}
Expand Down Expand Up @@ -651,6 +660,7 @@ export const HTTPFuzzerPage: React.FC<HTTPFuzzerPageProp> = (props) => {
<Row style={{flex: "1"}} gutter={5}>
<Col span={getLeftSpan()}>
<HTTPPacketEditor
system={system}
simpleMode={viewMode === "result"}
refreshTrigger={refreshTrigger}
hideSearch={true} bordered={true}
Expand Down
1 change: 1 addition & 0 deletions app/renderer/src/main/src/routes/routeSpec.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@ export interface MenuDataProps {
export const NoScrollRoutes: Route[] = [
Route.HTTPHacker,
Route.Mod_Brute,
Route.YakScript
];

export const RouteMenuData: MenuDataProps[] = [
Expand Down
11 changes: 11 additions & 0 deletions app/renderer/src/main/src/utils/editors.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
.hex-editor-style.cCsCJP .byteValue > .nybbleHighValue {
word-spacing: -0.5em;
}

.hex-editor-style.cCsCJP .byteValue > .nybbleLowValue {
word-spacing: -0.5em;
}

.hex-editor-style.cCsCJP .asciiValue {
word-spacing: -0.5em;
}
5 changes: 5 additions & 0 deletions app/renderer/src/main/src/utils/editors.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ import {
import {HTTPPacketFuzzable} from "../components/HTTPHistory";
import ReactResizeDetector from "react-resize-detector";

import './editors.css'

export type IMonacoActionDescriptor = monaco.editor.IActionDescriptor;

export type IMonacoEditor = monacoEditor.editor.IStandaloneCodeEditor;
Expand Down Expand Up @@ -221,6 +223,8 @@ export interface HTTPPacketEditorProp extends HTTPPacketFuzzable {

// lang
language?: "html" | "http" | "yak" | any

system?:string
}

export const YakCodeEditor: React.FC<HTTPPacketEditorProp> = (props) => {
Expand Down Expand Up @@ -426,6 +430,7 @@ export const HTTPPacketEditor: React.FC<HTTPPacketEditorProp> = (props) => {
{...props.extraEditorProps}
/>}
{mode === "hex" && !empty && <HexEditor
className={props.system==='Windows_NT' ? 'hex-editor-style' : ''}
showAscii={true}
data={hexValue}
showRowLabels={true}
Expand Down

0 comments on commit a13ab2b

Please sign in to comment.