Saturday, November 12, 2016

Java regular expression in Android dumpsys pattern matching

Objective: Extract dumpsys information and read the RSSI / signal strength value

// Dumpsys to grep the signal message
String signalValueText = "";
String dumpsys_log = Android.adbCommand(device, "adb -s " + Android.getSerialNumber(device) + " shell dumpsys telephony.registry | grep mSignalStrength=SignalStrength");
sleep(500);

// set regular expression to match pattern 
String pattern = "(.*)(SignalStrength:) (\\d{1,3}) (\\d{1,3}) -(\\d{1,3}) -(\\d{1,3}) -(\\d{1,3}) -(\\d{1,3}) -(\\d{1,3}) (\\d{1,3}) -(\\d{1,3}) -(\\d{1,3}) (\\d{1,3}) (\\d+) (\\d+) (gsm)(.*)";

// Create search pattern object
Pattern r = Pattern.compile(pattern);

// match the pattern and acquire right value, Extract all digits value from the string
Matcher m = r.matcher(dumpsys_log);
   if (m.find( )) {
    signalValueText = m.group(11);
   }else {
       Android.sequenceFail(deviceId, "dumpsys log NO match found! - FAILED");
   sleep(500);
   }
   
int signalValue = Integer.parseInt(signalValueText);
if (signalValue <100 amp="" signalvalue=""> 50)
{
System.out.println("Signal Strength = -" + signalValue);
sleep(500);
}
else 
{
System.out.println("Signal Strength range verification - FAILED, Current value = -" + signalValue);
sleep(500);
}

Tuesday, October 25, 2016

First AutoIt v3 script mouse click by coordinate creation

This script below will look 1000 times by clicking the 2 continuous mouse positions

Opt("Windows Title", 2)

For $i = 1 To 1000
$pos = WinGetPos("Windows Title")
$x = 439
$y = 250

WinWaitActive("Windows Title")
MouseClick("left", $pos[0] + $x, $pos[1] + $y)


$x = 371
$y = 304

WinWaitActive("Windows Title")
MouseClick("left", $pos[0] + $x, $pos[1] + $y)

Next

Wednesday, October 12, 2016

Learning /proc/kalllsyms and interpretation

http://board.issociate.de/thread/508268/prockallsyms.html


The symbol type. At least the following types are used; others are, as

well, depending on the object file format. If lowercase, the symbol is
local; if uppercase, the symbol is global (external).

A
The symbol's value is absolute, and will not be changed by
further linking.
B
The symbol is in the uninitialized data section (known as BSS).
C
The symbol is common. Common symbols are uninitialized data.
When linking, multiple common symbols may appear with the same name.
If the symbol is defined anywhere, the common symbols are treated as
undefined references.
D
The symbol is in the initialized data section.
G
The symbol is in an initialized data section for small
objects. Some object file formats permit more efficient access to
small data objects, such as a global int variable as opposed to a
large global array.
I
The symbol is an indirect reference to another symbol. This is
a GNU extension to the a.out object file format which is rarely used.
N
The symbol is a debugging symbol.
R
The symbol is in a read only data section.
S
The symbol is in an uninitialized data section for small object=
s.
T
The symbol is in the text (code) section.
U
The symbol is undefined.
V
The symbol is a weak object. When a weak defined symbol is
linked with a normal defined symbol, the normal defined symbol is used
with no error. When a weak undefined symbol is linked and the symbol
is not defined, the value of the weak symbol becomes zero with no
error.
W
The symbol is a weak symbol that has not been specifically
tagged as a weak object symbol. When a weak defined symbol is linked
with a normal defined symbol, the normal defined symbol is used with
no error. When a weak undefined symbol is linked and the symbol is not
defined, the value of the weak symbol becomes zero with no error.
-
The symbol is a stabs symbol in an a.out object file. In this
case, the next values printed are the stabs other field, the stabs
desc field, and the stab type. Stabs symbols are used to hold
debugging information.
?
The symbol type is unknown, or object file format specific.



> cat /proc/kallsyms shows below output. Wat is the second column
> represents. I could see- D, d, t, T, r etc on the second coumn.
>
>
>
> 0000000000004000 D per_cpu__gdt_page
> 0000000000005000 d per_cpu__exception_stacks
> 000000000000b000 d per_cpu__idt_desc
> 000000000000b010 d per_cpu__xen_cr0_value
> 000000000000b018 D per_cpu__xen_vcpu
> 000000000000b020 D per_cpu__xen_vcpu_info
> 000000000000b060 d per_cpu__mc_buffer
>
> ffffffff81866397 t init_trace_printk
> ffffffff8186eb4b T printk_all_partitions
> ffffffff818bdbd8 t __setup_str_setup_early_printk
> ffffffff818f0c00 t __setup_setup_early_printk
> ffffffff818f1800 t __initcall_init_trace_printkearly
> ffffffff818f1bd8 t __initcall_init_trace_printk_function_export5
> ffffffff81992fc0 b printk_buf
> ffffffffa01955a0 r __ksymtab_v4l_printk_ioctl =A0 [videodev]

Wednesday, July 27, 2016

How to generate SSH Keygen

How to generate SSH Keygen

cybertech@cybertech01> ssh-keygen -t rsa
Generating public/private rsa key pair.
Enter file in which to save the key (/user/cybertech/.ssh/id_rsa):
Created directory '/user/cybertech/.ssh'.
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /user/cybertech/.ssh/id_rsa.
Your public key has been saved in /user/cybertech/.ssh/id_rsa.pub.
The key fingerprint is:
c3:0d:9b:7b:ce:87:e2:a0:dd:75:be:26:f2:d2:1a:8c cybertech@cybertech01
The key's randomart image is:
+--[ RSA 2048]----+
|                 |
|                 |
|        .        |
|       . =       |
|        S .      |
|       o o       |
|      E +.o..    |
|     o o+*+oo    |
|    . ..+*++o.   |
+-----------------+

Thursday, June 16, 2016

SunOS korn shell setting

# Korn shell profile and kshrc example
http://osr507doc.sco.com/en/OSUserG/_The_Korn_shell_profile_and_kshrc.html

# Enable backspace keystroke
http://www.unix.com/solaris/118270-using-backspace-solaris-help.html

stty erase ^?



# Console key to move up and down
set -o emacs

OR

set -o vi


Sunday, May 8, 2016

Remove empty element in array for perl

http://forums.devshed.com/perl-programming-6/delete-empty-array-elements-299537.html

# remove empty elements from array
@data = grep length($_), @data;

Thursday, March 31, 2016

Single command to replace string in Perl

Ref:
https://techome.wordpress.com/2007/12/22/perl-commandline-search-and-replace/
http://www.atrixnet.com/in-line-search-and-replace-in-files-with-real-perl-regular-expressions/


C:\strawberry\perl\bin\perl.exe -pe "s/\\audio_hole_log\\/\\audio_hole_log/g" 

-e option allows you to define Perl code to be executed by the compiler. For example, it’s not necessary to write a “Hello World” program in Perl when you can just type this at the command line.
# perl -e ‘print “Hello World\n”‘
-p option, adds loops around your -e code.It creates code like this:
LINE:
while (<>) {
# your code goes here
} continue {
print or die “-p destination: $!\n”;
}
-i option. Actually, Perl renames the input file and reads from this renamed version while writing to a new file with the original name. If -i is given a string argument, then that string is appended to the name of the original version of the file. For example, to change all occurrences of “PHP” to “Perl” in a data file you could write something like this:
# perl -i -pe ‘s/PHP/Perl/g’ file.txt

Monday, March 28, 2016

Linux web page error message location


Error File location for page error:
sudo cat /var/log/httpd/error_log


Wednesday, March 23, 2016

Listing Perl Modules - default or local installed

http://www.perlhowto.com/list_the_installed_modules

This additional
~$ cpan -l

There are several ways to obtain the list of perl modules installed in a system:
-- Using perldoc
There are 2 commands, depending of the kind of perl module:
perldoc perlmodlib
'perldoc perlmodlib' list the modules that come preinstalled with the standard perl package.
perldoc perllocal
'perldoc perllocal' lists the optional modules that are installed in your system that don't come with perl by default.
This command returns lots of useful information for every optional module installed, like the installation date, the directory where the module was installed, the module version number, etc.
-- Using a script
If you want to obtain the list of all modules installed using a script, you may use the following one-liner (have a look at 'perldoc perlmodlib' for details about this one-liner):
perl -MFile::Find=find -MFile::Spec::Functions -Tlw
     -e 'find { wanted => sub { print canonpath $_ if /\.pm\z/ },
         no_chdir => 1 }, @INC'
-- If using ActivePerl
If you use ActivePerl (very likely if you're using Perl in Windows), you may use the following command to obtain the list of modules:
ppm query

Friday, January 8, 2016

How to host bugzilla in RHEL6

http://bugzilla.readthedocs.org/en/latest/installing/linux.html

https://www.rosehosting.com/blog/how-to-install-bugzilla-on-centos-6/

http://ftp.mozilla.org/pub/webtools/


http://www.thegeekstuff.com/2010/05/install-bugzilla-on-linux/


1. Install perl, httpd, mysql-server, etc
2. Install perl modules (perl install-module.pl --all)
3. Configure mysql-server config files
4.

 yum install httpd mysql-server mod_perl mod_perl-devel httpd-devel 

Troubleshooting MySQL:
http://stackoverflow.com/questions/11657829/error-2002-hy000-cant-connect-to-local-mysql-server-through-socket-var-run