【问题标题】:How to launch an app in memory on linux system如何在 Linux 系统上启动内存中的应用程序
【发布时间】:2020-07-04 00:39:57
【问题描述】:

我读取加密文件,在缓冲区中解密。我怎么能运行解密的代码? 我应该跳到哪里?我知道,在 DOS 中,跳转到缓冲区偏移量 0x100,这是代码入口点。 linux下呢?

谢谢 西安

【问题讨论】:

  • 文件是什么格式的?它是否需要定位才能在您加载它的地方运行?您需要在缓冲区上设置执行权限。
  • 文件由gcc生成。比如 gcc abc.c -o abc

标签: linux shell operating-system


【解决方案1】:

尝试使用tail -c(输出最后K字节)。

完整答案:

先从十六进制转换为十进制(转换前去掉“0x”)

然后,找到您的输入文件大小。扣除0x100

hex="100"
# convert hex to dec
dec=$(echo "obase=10; ibase=16; ${hex}" | bc)
# input_file size in bytes
file_size=$(stat --printf="%s" input_file)
truncated_file_size=$(($file_size - $dec))
tail -c $truncated_file_size input_file > new_file 

【讨论】:

  • 我对你的回答感到困惑。这个脚本是做什么的?
猜你喜欢
  • 2014-02-27
  • 1970-01-01
  • 2018-03-01
  • 1970-01-01
  • 2013-02-28
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多