合天安全实验室CTF之基础100

下载一个文本misc.txt,打开来一看,什么鬼,全是3个一组的数字

马上想到是RGB三原色,一共61366组,就先创建一个256*256的白色画布

这就是白色画布,不用怀疑,你马上就能看到了

然后就是对白色画布的填充

创建一个PicTest.java,代码如下:

public class PicTest {
	public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(
				new FileInputStream("G:\\misc100.txt")));
		int i,j;
		
		String line = br.readLine();
		int rgb[] = new int[3];
		File file = new File("G:\\1.jpg");// 实例化file对象,并设置读取图片路径
		BufferedImage bi = null; // 像素缓冲区开始为空
		bi = ImageIO.read(file);
		int width = bi.getWidth();
		int height = bi.getHeight();
		int minx = bi.getMinX();
		int miny = bi.getMinY();
		for (i = 0; i < width; i++) {
			for (j = 0; j < height; j++) {
//				int pixel = bi.getRGB(i, j);
//				rgb[0] = (pixel & 0xff0000) >> 16;
//				rgb[1] = (pixel & 0xff00) >> 8;
//				rgb[2] = (pixel & 0xff);
//				System.out.println("i=" + i + ",j=" + j + ":(" + rgb[0] + ","
//						+ rgb[1] + "," + rgb[2] + ")"+pixel);
				if(line == null) break;
				String[] rgbs=line.toString().split(",");
				rgb[0]=new Integer(rgbs[0]);
				rgb[1]=new Integer(rgbs[1]);
				rgb[2]=new Integer(rgbs[2]);
				bi.setRGB(i, j, Integer.parseInt(Integer.toHexString(rgb[0])+Integer.toHexString(rgb[1])+Integer.toHexString(rgb[2]),16));
				//bi.setRGB(i, j, Integer.parseInt("ffffff",16));
				line = br.readLine();
			}
		}
		ImageIO.write(bi, "JPEG", file); //写入文件
		br.close();
	}
}
OK,我们来看看效果


什么鬼,调整一下图片的高和宽,变成256和245


OK,找到了flag{ youc@n'tseeme }

提交,通过!

  • 3
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 5
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 5
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值