Created
February 6, 2021 13:48
-
-
Save morimolymoly/3457fb53fc0db319e2d07b4973dc5811 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.io.*; | |
public class decrypt { | |
public static void main(String[] args) { | |
System.out.println("hello, world!"); | |
InputStream input = null; | |
try { | |
input = new FileInputStream("1k7vcor"); | |
} catch (FileNotFoundException e) { | |
} | |
byte[] flag_str = new byte[0xb]; | |
try { | |
input.read(flag_str); | |
} catch (IOException e) { | |
} | |
int flag = (int)flag_str[8] & 0xff | ((int)flag_str[9] & 0xff) << 8 | ((int)flag_str[10] & 0xff) << 0x10; | |
byte[] content_tmp = new byte[1]; | |
try { | |
input.read(content_tmp); | |
} catch (IOException e) { | |
} | |
decrypt(flag, content_tmp[0], input); | |
} | |
static void decrypt(int flags, byte content, InputStream input) { | |
OutputStream output = null; | |
int iVar1; | |
InputStream pIVar2; | |
Object ref_00; | |
ByteArrayOutputStream local_0; | |
byte[] pbVar3; | |
int iVar4; | |
Object[] ppOVar5; | |
local_0 = new ByteArrayOutputStream(); | |
pbVar3 = new byte[0x1000]; | |
while( true ) { | |
iVar1 = Math.min(flags,0x1000); | |
try { | |
iVar1 = input.read(pbVar3,0,iVar1); | |
} catch (IOException e) { | |
} | |
if ((iVar1 == -1) || (iVar1 == 0)) break; | |
flags = flags - iVar1; | |
iVar4 = 0; | |
while (iVar4 < iVar1) { | |
pbVar3[iVar4] = (byte)(pbVar3[iVar4] ^ content); | |
iVar4 = iVar4 + 1; | |
} | |
local_0.write(pbVar3,0,iVar1); | |
} | |
try { | |
output = new FileOutputStream("decrypted"); | |
local_0.writeTo(output); | |
} catch (FileNotFoundException e) { | |
} catch (IOException e2) { | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment