bash

gdb exiting instead of spawning a shell

淺唱寂寞╮ 提交于 2021-02-07 20:09:15
问题 I am trying to exploit a SUID program. The program is: #include <stdlib.h> #include <unistd.h> #include <string.h> #include <stdio.h> #define e(); if(((unsigned int)ptr & 0xff000000)==0xca000000) { setresuid(geteuid(), geteuid(), geteuid()); execlp("/bin/sh", "sh", "-i", NULL); } void print(unsigned char *buf, int len) { int i; printf("[ "); for(i=0; i < len; i++) printf("%x ", buf[i]); printf(" ]\n"); } int main() { unsigned char buf[512]; unsigned char *ptr = buf + (sizeof(buf)/2); unsigned

Awk: Splitting file on nth occurence of delimiter, wrong first split file

可紊 提交于 2021-02-07 19:54:05
问题 I want to split a text file like the one pasted below (sorry for the length), on every n occurence of ">". For example, every 2nd occurrence of ">", but I need to able able to change that number. test_split.txt: >eeefkdfn a a a >c 4ufjdhf b b b b > c c > c d d d d d >3 >cr >c3 e e e e e > 5 f f f f >cr g g g g > cr dkjfddf h h h h So I want to have output files this these (only showing the first two): file_1.txt: >eeefkdfn a a a >c 4ufjdhf b b b b file_2.txt: > c c > c d d d d d etc. Question

Awk: Splitting file on nth occurence of delimiter, wrong first split file

帅比萌擦擦* 提交于 2021-02-07 19:53:13
问题 I want to split a text file like the one pasted below (sorry for the length), on every n occurence of ">". For example, every 2nd occurrence of ">", but I need to able able to change that number. test_split.txt: >eeefkdfn a a a >c 4ufjdhf b b b b > c c > c d d d d d >3 >cr >c3 e e e e e > 5 f f f f >cr g g g g > cr dkjfddf h h h h So I want to have output files this these (only showing the first two): file_1.txt: >eeefkdfn a a a >c 4ufjdhf b b b b file_2.txt: > c c > c d d d d d etc. Question

How to get environment variable PS1 by golang?

泄露秘密 提交于 2021-02-07 19:44:49
问题 PS1 is an environment variable for bash prompt. I can get this by echo $PS1 I try to use os.Getenv to get PS1 but returns nothing: package main import ( "fmt" "os" ) func main() { fmt.Println(os.Getenv("PS1")) } Why does this happen and how should I fix this? Thanks. 回答1: PS1 is probably not exported, meaning it won't show up in sub-processes of bash try export PS1 before you run your app you could also do PS1=$PS1 app to set it specifically in the sub process 来源: https://stackoverflow.com

How do I suppress output from this Shell command

自作多情 提交于 2021-02-07 19:16:51
问题 Why are the redirection operations in this command line apparently ignored by bash? I aim to redirect standard error to standard out, and then feed the whole lot into the void. ( cd ../src/ && python -m SimpleHTTPServer 8000 2>&1 > /dev/null ) & I'm running a SimpleHTTPServer on some static web content, so that wget can check it for dead links. However, I don't want to see the errors from the server (requests for failed pages), as the wget log file provides all the information I need.

How do I suppress output from this Shell command

给你一囗甜甜゛ 提交于 2021-02-07 19:14:07
问题 Why are the redirection operations in this command line apparently ignored by bash? I aim to redirect standard error to standard out, and then feed the whole lot into the void. ( cd ../src/ && python -m SimpleHTTPServer 8000 2>&1 > /dev/null ) & I'm running a SimpleHTTPServer on some static web content, so that wget can check it for dead links. However, I don't want to see the errors from the server (requests for failed pages), as the wget log file provides all the information I need.

Can't use Ctrl+A and Ctrl+E (bash keybindings) on Terminal.app OSX

亡梦爱人 提交于 2021-02-07 18:26:28
问题 So for some odd reason, i can't use ^A and ^E on bash in Terminal.app, i can however, use ^C, ^R, ^Y, ^L and all sort of other key bindings. bind -p shows "\C-a": beginning-of-line "\C-e": end-of-line so i think something else is obstructing these key bindings... any idea how i can fix that? or at least know if ^A and ^E are being taken by some other app? highly appreciated 回答1: I must note the following: Ctrl+Alt+A and Ctrl+Alt+E seem to do what Ctrl+A and Ctrl+E should do. So when i run

Can't use Ctrl+A and Ctrl+E (bash keybindings) on Terminal.app OSX

戏子无情 提交于 2021-02-07 18:26:18
问题 So for some odd reason, i can't use ^A and ^E on bash in Terminal.app, i can however, use ^C, ^R, ^Y, ^L and all sort of other key bindings. bind -p shows "\C-a": beginning-of-line "\C-e": end-of-line so i think something else is obstructing these key bindings... any idea how i can fix that? or at least know if ^A and ^E are being taken by some other app? highly appreciated 回答1: I must note the following: Ctrl+Alt+A and Ctrl+Alt+E seem to do what Ctrl+A and Ctrl+E should do. So when i run

Can't use Ctrl+A and Ctrl+E (bash keybindings) on Terminal.app OSX

安稳与你 提交于 2021-02-07 18:26:08
问题 So for some odd reason, i can't use ^A and ^E on bash in Terminal.app, i can however, use ^C, ^R, ^Y, ^L and all sort of other key bindings. bind -p shows "\C-a": beginning-of-line "\C-e": end-of-line so i think something else is obstructing these key bindings... any idea how i can fix that? or at least know if ^A and ^E are being taken by some other app? highly appreciated 回答1: I must note the following: Ctrl+Alt+A and Ctrl+Alt+E seem to do what Ctrl+A and Ctrl+E should do. So when i run

Git remote push: failed to load advapi32.dll

可紊 提交于 2021-02-07 18:21:03
问题 I am new to Git and Github; and I came across a problem. There is a similiar question here (git bash failed to load advapi32.dll), but they are experiencing a different problem and there are no answers either. I have searched online and was unable to fix this. Here is the issue: I am using Git Bash to push/pull commits to Github. When I try to push my work, I get this error saying "failed to load advapi32.dll ". I do have this file in my registry. The full Git message is bellow. It is worth