Related
I wrote a small script with a wget command:
wget https://xxxxxxxlain.html?url=&meth=plain&action=login&time=480&uid=xxx&pswd=xxxx&submit=1
the script is called sesame
Put in on root of sd
terminal emulator:
Code:
$ su
# chmod 777 sesame
# ./sesame
: permission denied
How can that be?
Because the G1 uses ash, not bash, as its shell/CLI.
Rather than "./", use "sh ./"
IConrad01 said:
Because the G1 uses ash, not bash, as its shell/CLI.
Rather than "./", use "sh ./"
Click to expand...
Click to collapse
also, unless you had previously cd'ed to sdcard you must add the path so
Code:
sh /sdcard/sesame
should work
That's implicit when you understand the "." to mean "current directory".
I.e.; "find . -print" will print out every file in your current directory in a list. Going a step fancier you could also use "find . | grep .apk" to find all .apk's in your active directory.
Fun with commands!
Hey is anyone else getting Segmentation Faults when trying to start applications via command line through Connectbot? Does this just affect ICS?
[email protected]:/ # am start -n com.google.android.contacts/.ContactsActivity
[2] + Stopped (signal) am
[1] - Segmentation Fault am start -n com.google.android.contacts/.ContactsActivity
ws6kid said:
Hey is anyone else getting Segmentation Faults when trying to start applications via command line through Connectbot? Does this just affect ICS?
[email protected]:/ # am start -n com.google.android.contacts/.ContactsActivity
[2] + Stopped (signal) am
[1] - Segmentation Fault am start -n com.google.android.contacts/.ContactsActivity
Click to expand...
Click to collapse
I'm no Mod, but this looks like it belongs in Q&A...not Dev.
same problem in NKD
I have same problem. 'am start' causes seg. fault in ICS CM9 roms.
i run am command from C using:
Code:
system("am start -a android.intent.action.MAIN -n package/activity");
Bumping this, because today I find the same problem on Jelly Bean.
Code:
$ ssh [email protected]
Welcome to DropBear SSH Server II!
[email protected]'s password:
# am
[1] Segmentation fault am
#
This is on Jelly Bean 4.1.2. Different device (Samsung Xcover 2), but this topic was the only one I could find about it. Not using CyanogenMod (using stock Samsung system.img rooted by adding su binary and flashing that).
I tried two different dropbear sshd apps; with both I had this issue. Might be the same dropbear version, though. I didn't look into that. It seems to happen with any am command (tried 'am help', 'am' and 'am start -n <bladibla>').
Upfronts: I'm using NottachTrix 1.3.1 with the 2.3.6 Webtop. I'm also a programmer and a network administrator, so I might be a little more comfortable poking around in things that might break my phone than other users. Don't do anything you aren't comfortable with! I'm just reporting my findings. Your phone, your comfort level, your business!
I wanted to get my new lapdock to use the cellular network without jumping through any "enable/disable mobile hotspot" hoops. I finally got all the webtop2sd stuff running, including a working lxterminal and synaptic. I was running synaptic as root from a bash shell ("sudo bash" to give me a root shell, other commands as needed). I noticed that synaptic worked without wifi but firefox didn't. I could also ping various websites with no trouble under the root shell, but the adas user could not. adas COULD ping IP addresses, though, so it seemed like there was a firewall in place that was blocking adas from resolving domain names.
As it turns out, there is a firewall in place that is blocking the adas user from resolving domain names.
Webtop seems to be using iptables to restrict access to the default login user. I typed "iptables -L" to view all the iptables-based firewalling that was going on. Sure enough, three entries existed to block network traffic for the user "adas". After an "iptables -S" to get the commands that were used to turn on the filtering, I was able to reverse the process. (Hint: -A adds a rule, -D deletes one)
From here, I could do a lot of things -- create a script to disable iptables on demand, block the commands from running in the first place, dance a happy little jig... I won't embarrass myself by revealing which I actually did, but hopefully there's enough in this post that will help others resolve their problems in a similar manner!
(By the way, every time the phone is docked, it re-blocks network access, apparently using a file called "syslog-restart".)
If you could fix this would be great, I have the same rom and everything and I use my LapDock in my business and it is always a pain to make it connect and most of the times it fails to connect for me.
Cheers
The following presumes a working lxterminal and synaptic (or apt-get). If you haven't run the webtopscripts to fix the broken dependencies, now's a good time to poke that bear*.
(Type the stuff that's in bold -- comments are in italics)
In lxterminal:
sudo apt-get install nano (Command-line text editor)
iptables -S (generates a list of rules that iptables is currently using)
copy any lines in the "-P OUTPUT ACCEPT" section that start with "-A"
create a new file in nano by typing nano fwdisable.sh
at the top of the new document, type #!/bin/bash and press Enter
paste the copied lines into the resulting screen
insert iptables at the start of each line and change "-A" to "-D" (A for add, D for delete)
once the file looks the way you think it should, exit the program with CTRL-X, saving the file when it asks
at the command prompt, type chmod 755 fwdisable.sh
run your new shell script with sudo ./fwdisable.sh
open up a web browser and enjoy!
* Please don't poke any bears. While they may look fluffy, they react poorly to being poked. There's probably a good metaphor about messing around in the internals of your phone in there somewhere, but for the life of me I just can't find it!
Did you guys can edit a ROM that has it all in a matter of WebTop, I can not make it work on my Atrix in any way.
I do not have the device only the HDMI cable.
Trying to save fwdisable.sh nano give me following error
"Error writing fwdisable.sh Read-only file system"
Please advise
pederb said:
Trying to save fwdisable.sh nano give me following error
"Error writing fwdisable.sh Read-only file system"
Please advise
Click to expand...
Click to collapse
Sounds like you're not root or su
Sent from my MB860 using Tapatalk 2
Ok the drive was write protected, but now I get
" ./fwdisable.sh: line 2: -D: command not found"
" ./fwdisable.sh: line 3: -D: command not found"
I was not able to get it to work with Nano so I used gedit instead but should not make a difference, right?
Any idea?
maybe someone can create a flashable fix so that its easy for some of us noobs lol
studean said:
The following presumes a working lxterminal and synaptic (or apt-get). If you haven't run the webtopscripts to fix the broken dependencies, now's a good time to poke that bear*.
(Type the stuff that's in bold -- comments are in italics)
In lxterminal:
sudo apt-get install nano (Command-line text editor)
iptables -S (generates a list of rules that iptables is currently using)
copy any lines in the "-P OUTPUT ACCEPT" section that start with "-A"
create a new file in nano by typing nano fwdisable.sh
at the top of the new document, type #!/bin/bash and press Enter
paste the copied lines into the resulting screen
insert iptables at the start of each line and change "-A" to "-D" (A for add, D for delete)
once the file looks the way you think it should, exit the program with CTRL-X, saving the file when it asks
at the command prompt, type chmod 755 fwdisable.sh
run your new shell script with sudo ./fwdisable.sh
open up a web browser and enjoy!
* Please don't poke any bears. While they may look fluffy, they react poorly to being poked. There's probably a good metaphor about messing around in the internals of your phone in there somewhere, but for the life of me I just can't find it!
Click to expand...
Click to collapse
Follow this guide guys, it is ridiculously easy, no flashing needed.
I also added a button to the AWN dock with the command:
sudo ./fwdisable.sh
Which will give you one click disabling of the firewall. It will restart the firewall each time you dock/undock it appears, so just dock it, click the firewall disable button and you are good to go.
Norcalz71 said:
Follow this guide guys, it is ridiculously easy, no flashing needed.
I also added a button to the AWN dock with the command:
sudo ./fwdisable.sh
Which will give you one click disabling of the firewall. It will restart the firewall each time you dock/undock it appears, so just dock it, click the firewall disable button and you are good to go.
Click to expand...
Click to collapse
Well I'm still getting my error no matter how many time I try it again
man i cant even get webtop2sd to work. as soon as i run it on my phone it force closes. i havent even got it to open longer then super user request yet.
fingers crossed on a cwm flashable lol.
Thanks for this. I was wondering why apt-get update would work but adas couldn't ping out properly over 3g.
Also, thank you for the walk through in editing iptables there. Interesting that they chose to use that over something more proprietary, or well hidden.
I had this problem at first, too -- I think it was busybox-related. There's a busybox updater or two in the Market (I mean, "Play Store") that will bring you up to speed and let you install webtop2sd.
Sorry it's been so long since my last post! It appears that you didn't insert an "iptables " before the "-D". Check to make sure that each line after the "#!/bin/bash" starts with "iptables -D" instead of just "-D" and see if that takes care of the problem. (Also make sure you execute the script with a "sudo" -- iptables won't work properly as a regular user...)
studean said:
Sorry it's been so long since my last post! It appears that you didn't insert an "iptables " before the "-D". Check to make sure that each line after the "#!/bin/bash" starts with "iptables -D" instead of just "-D" and see if that takes care of the problem. (Also make sure you execute the script with a "sudo" -- iptables won't work properly as a regular user...)
Click to expand...
Click to collapse
should it be,
iptables -D
or
-D iptables
[email protected]:/$ sudo iptables -S
-P INPUT ACCEPT
-P FORWARD ACCEPT
-P OUTPUT ACCEPT
FATAL: Could not load /lib/modules/2.6.32.56-MB860-faux123-GB-024/modules.dep: No such file or directory
FATAL: Could not load /lib/modules/2.6.32.56-MB860-faux123-GB-024/modules.dep: No such file or directory
-A OUTPUT -d 127.0.0.1/32 -p tcp -m tcp --dport 8086 -m owner ! --uid-owner adas -j REJECT --reject-with icmp-port-unreachable
-A OUTPUT -d 127.0.0.1/32 -p tcp -m tcp --dport 8085 -m owner ! --uid-owner adas -j REJECT --reject-with icmp-port-unreachable
This is how it looks before editing
It should be "iptables -D". Based on the output from your "iptables -S" command, the file should look like this:
Code:
#/bin/bash
iptables -D OUTPUT -d 127.0.0.1/32 -p tcp -m tcp --dport 8086 -m owner ! --uid-owner adas -j REJECT --reject-with icmp-port-unreachable
iptables -D OUTPUT -d 127.0.0.1/32 -p tcp -m tcp --dport 8085 -m owner ! --uid-owner adas -j REJECT --reject-with icmp-port-unreachable
I also had a third line (that escapes me at the moment -- I'm on a different machine) that further blocked access, but apparently there is a bit of variation in the configuration... At any rate, create the file using whatever text editor you feel most comfortable using, then "chmod 755" the file to make it executable. If you call it "fwdisable.sh", then you should type "chmod 755 fwdisable.sh" in lxterminal and run the file with "sudo ./fwdisable.sh" to disable the firewall.
Good luck! If you want to know more about the workings of this stuff, google "bash scripting guide" and (for a general overview) read the wikipedia page for "iptables". It will help you understand what's up with all these seemingly weird commands...
That worked, but now I get these error messages?
[email protected]:/$ sudo ./fwdisable.sh
FATAL: Could not load /lib/modules/2.6.32.56-MB860-faux123-GB-024/modules.dep: No such file or directory
FATAL: Could not load /lib/modules/2.6.32.56-MB860-faux123-GB-024/modules.dep: No such file or directory
FATAL: Could not load /lib/modules/2.6.32.56-MB860-faux123-GB-024/modules.dep: No such file or directory
FATAL: Could not load /lib/modules/2.6.32.56-MB860-faux123-GB-024/modules.dep: No such file or directory
[email protected]:/$
Click to expand...
Click to collapse
Please advice
Cheers
You should be okay with those error messages. I'm not entirely sure WHY it's looking for that file, but it's "normal" output. If you'll remember, it's the same output you got in the "iptables -S" command... Something about accessing iptables causes the system to look for that file. (I just haven't been bothered enough over it to check yet...)
To verify, run "sudo iptables -S" again to see if there is anything left. You should just see three lines:
Code:
-P INPUT ACCEPT
-P FORWARD ACCEPT
-P OUTPUT ACCEPT
Anything more than that and you might need to edit your script as you did before. If the output from "iptables -S" looks like the above, though, fire up firefox and give it a whirl!
studean said:
You should be okay with those error messages. I'm not entirely sure WHY it's looking for that file, but it's "normal" output. If you'll remember, it's the same output you got in the "iptables -S" command... Something about accessing iptables causes the system to look for that file. (I just haven't been bothered enough over it to check yet...)
To verify, run "sudo iptables -S" again to see if there is anything left. You should just see three lines:
Code:
-P INPUT ACCEPT
-P FORWARD ACCEPT
-P OUTPUT ACCEPT
Anything more than that and you might need to edit your script as you did before. If the output from "iptables -S" looks like the above, though, fire up firefox and give it a whirl!
Click to expand...
Click to collapse
[email protected]:/$ sudo iptables -S
-P INPUT ACCEPT
-P FORWARD ACCEPT
-P OUTPUT ACCEPT
FATAL: Could not load /lib/modules/2.6.32.56-MB860-faux123-GB-024/modules.dep: No such file or directory
FATAL: Could not load /lib/modules/2.6.32.56-MB860-faux123-GB-024/modules.dep: No such file or directory
-A OUTPUT -o ppp0 -m owner --uid-owner adas -j REJECT --reject-with icmp-port-unreachable
[email protected]:/$
Excellent! This means you're almost there! As before, copy/paste that line into your shell script, change the "-A" to "iptables -D" and that SHOULD be the end of it.
No, really. This time for sure. Just re-run the script when you're done (ignoring the "fatal" stuff) and you'll be browsing in no time!
Hey, I wonder if anyone is good with BASH is around here, what I want is simple, but for some reason it didn't work for me
So here is what I want, a .sh (or any other linux executable) file that executes the following code if the user input was the character 'm'
Code:
sudo mkdir /media/mp3
sudo chmod 775 /media/mp3
sudo mtpfs -o allow_other /media/mp3
and this if the input was 'u'
Code:
sudo umount /media/mp3
sudo rmdir /media/mp3
anything else: exit
thanks in advance
are you looking for something like this?
Code:
#!/bin/bash
if [ `whoami` != "root" ]; then
echo "you must execute this script with root priveleges!"
exit
fi
clear
echo
echo "enter m to mount /media/mp3 or enter u to unmount it"
echo
read moru
if [ "$moru" = "m" ]; then
mkdir -p /media/mp3
chmod 775 /media/mp3
mtpfs -o allow_other /media/mp3
elif [ "$moru" = "u" ]; then
umount /media/mp3
rmdir /media/mp3
fi
exit
HTH
the code seems ok, but still not working, the is the output in kate when I pipe it to terminal
(not that I was root when before I pipe it using su)
Code:
Dash-Netbook Desktop # #!/bin/bash
Dash-Netbook Desktop #
Dash-Netbook Desktop # if [ `whoami` != "root" ]; then
> echo "you must execute this script with root priveleges!"
echo "you must execute this script with root priveleges"]; then
bash: syntax error near unexpected token `then'
Dash-Netbook Desktop # exit
exit
[email protected] ~/Desktop $ fi
bash: syntax error near unexpected token `fi'
[email protected] ~/Desktop $
[email protected] ~/Desktop $ clear
[email protected] ~/Desktop $ echo
[email protected] ~/Desktop $ echo "enter m to mount /media/mp3 or enter u to unmount it"
enter m to mount /media/mp3 or enter u to unmount it
[email protected] ~/Desktop $ echo
[email protected] ~/Desktop $ read moru
[email protected] ~/Desktop $
[email protected] ~/Desktop $ if [ "$moru" = "m" ]; then
> mkdir -p /media/mp3
> chmod 775 /media/mp3
> mtpfs -o allow_other /media/mp3
> elif [ "$moru" = "u" ]; then
> umount /media/mp3
> rmdir /media/mp3
> fi
[email protected] ~/Desktop $
[email protected] ~/Desktop $ exit
husam666 said:
Hey, I wonder if anyone is good with BASH is around here, what I want is simple, but for some reason it didn't work for me
So here is what I want, a .sh (or any other linux executable) file that executes the following code if the user input was the character 'm'
Code:
sudo mkdir /media/mp3
sudo chmod 775 /media/mp3
sudo mtpfs -o allow_other /media/mp3
and this if the input was 'u'
Code:
sudo umount /media/mp3
sudo rmdir /media/mp3
anything else: exit
thanks in advance
Click to expand...
Click to collapse
I know it sounds stuff, but I don't know my way around Linux. What does that script actually do?
Sent from my HTC Wildfire S A510e using XDA
Bad-Wolf said:
I know it sounds stuff, but I don't know my way around Linux. What does that script actually do?
Sent from my HTC Wildfire S A510e using XDA
Click to expand...
Click to collapse
the first part mounts my mp3 player (MTP device) on the /media/mp3 directory
The other part unmounts it and deletes the directory
Sent from the brick
What distribution are you using?
Also, what errors do you get when you save that text to a text file (do this in linux, not windows), e.g. mountmp3.sh, make it executable (chmod +x mountmp3.sh) and run it (./mountmp3.sh)?
It seems to run the commands fine here (running Porteus, which is based on Slackware) but I don't have mtpfs installed, so I'm not testing every element...
use this one Husam!
on a terminal:
Code:
sudo -s
chmod +x husam.sh
sh husam.sh
I tweaked the code a bit and added extra functionality
You might wanna try that script without root...
.Ahau said:
What distribution are you using?
Also, what errors do you get when you save that text to a text file (do this in linux, not windows), e.g. mountmp3.sh, make it executable (chmod +x mountmp3.sh) and run it (./mountmp3.sh)?
It seems to run the commands fine here (running Porteus, which is based on Slackware) but I don't have mtpfs installed, so I'm not testing every element...
Click to expand...
Click to collapse
ok, I'm using linux mint kde 12.1, and I use kate for a text editor, I didn't do the chmod thing, I only used sh file.sh
@dex, ok..
.Ahau said:
What distribution are you using?
Also, what errors do you get when you save that text to a text file (do this in linux, not windows), e.g. mountmp3.sh, make it executable (chmod +x mountmp3.sh) and run it (./mountmp3.sh)?
It seems to run the commands fine here (running Porteus, which is based on Slackware) but I don't have mtpfs installed, so I'm not testing every element...
Click to expand...
Click to collapse
ok, it worked
thx
@dex, what kind of idiot do you think I am -_-
I always check executables before executing
husam666 said:
ok, it worked
thx
@dex, what kind of idiot do you think I am -_-
I always check executables before executing
Click to expand...
Click to collapse
oh come on
I know you liked my modifications
dexter93 said:
oh come on
I know you liked my modifications
Click to expand...
Click to collapse
btw, should I check the link you gave me?
husam666 said:
btw, should I check the link you gave me?
Click to expand...
Click to collapse
the "surprise" one? depends.. if you are brave enough
(you already know what it is though)
but the download link in my post is legit, it works
dexter93 said:
the "surprise" one? depends.. if you are brave enough
(you already know what it is though)
but the download link in my post is legit, it works
Click to expand...
Click to collapse
lmao, check my latest fb status then
husam666 said:
lmao, check my latest fb status then
Click to expand...
Click to collapse
that's where i got the idea from
glad it's working for you!
Dears maybe now I can make double post but I hang on that step from guide from this site.
Phone is after wipe data and I need rescue data from it for that I want to make RAW image to recover data.
What I do until now:
adb forward tcp:5555 tcp:5555
adb shell
su
/system/xbin/busybox nc -l -p 5555 -e /system/xbin/busybox dd if=/dev/block/mmcblk0
but in results get:
1|ASUS_I001_1:/ # /system/xbin/busybox nc -1 -p 5555 -e /system/xbin/busybox dd
5555 -e /system/xbin/busybox dd if=/dev/block/mmcblk0 <
nc: invalid option -- 1
BusyBox v1.32.0-Stericson (2020-07-18 18:33:24 EDT) multi-call binary.
Usage: nc [OPTIONS] HOST PORT - connect
nc [OPTIONS] -l -p PORT [HOST] [PORT] - listen
-e PROG Run PROG after connect (must be last)
-l Listen mode, for inbound connects
-lk With -e, provides persistent server
-p PORT Local port
-s ADDR Local address
-w SEC Timeout for connects and final net reads
-i SEC Delay interval for lines sent
-n Don't do DNS resolution
-u UDP mode
-v Verbose
-o FILE Hex dump traffic
-z Zero-I/O mode (scanning)
1|ASUS_I001_1:/ #
Why I get that this parameter is invalid:
nc: invalid option -- 1
And to the end, if that don't work to me, next step also don't work.
Open another Cygwin terminal and type:
Code:
adb forward tcp:5555 tcp:5555
cd /path/to/store/the/backup ---> this is correct, should I creat some folder on HHD and insert here his name?
nc 127.0.0.1 5555 | pv -i 0.5 > mmcblk0.raw --> that means I should have ftp serwer?