是个jar可执行程序,安装了Java环境后在命令窗口输入命令就可执行。
java -jar 绝对路径
java -jar C:\Users\dell\Guess_the_number.jar
wrong guess!
java -jar C:\Users\dell\Guess_the_number.jar 1.5
please enter an integer
example: java -jar guess 12
可知在路径后面猜数字就可传参。
将jar文件解压,会得到一个.MF文件和一个guess.class文件。将guess.class用eclipse的插件jadclipse反编译guess.class得到源码。(首先要安装eclipse和配置好插件jadclipse)
导入无源的.class(即guess.class)需要配置:
1)把class目录加入项目:
1.1)Project->Properties->Java Build Path->Libraries->Add Class Folder->Create New Folder(如class)->OK
1.2)class->Import->General->File system->Browse->选择guess.class所在目录->OK
2)从class目录里找到guess.class双击,反编译成功
import java.io.PrintStream;
import java.math.BigInteger;
public class guess
{
public guess()
{
}
static String XOR(String _str_one, String _str_two)
{
BigInteger i1 = new BigInteger(_str_one, 16);
BigInteger i2 = new BigInteger(_str_two, 16);
BigInteger res = i1.xor(i2);
String result = res.toString(16);
return result;
}
public static void main(String args[])
{
int guess_number = 0;
int my_num = 349763335;
int my_number = 1545686892;
int flag = 345736730;
if(args.length > 0)
{
try
{
guess_number = Integer.parseInt(args[0]);//传入的参数
if(my_number / 5 == guess_number)
{//guess_number=309137378
String str_one = "4b64ca12ace755516c178f72d05d7061";
String str_two = "ecd44646cfe5994ebeb35bf922e25dba";
my_num += flag;
String answer = XOR(str_one, str_two);
System.out.println((new StringBuilder("your flag is: ")).append(answer).toString());
} else
{
System.err.println("wrong guess!");
System.exit(1);
}
}
catch(NumberFormatException e)
{
System.err.println("please enter an integer \nexample: java -jar guess 12");
System.exit(1);
}
} else
{
System.err.println("wrong guess!");
int num = 1000000;
num++;
System.exit(1);
}
}
}
将guess_number输入即可得到flag
java -jar C:\Users\dell\Desktop\Guess_the_number.jar 309137378
your flag is: a7b08c546302cc1fd2a4d48bf2bf2ddb