Thursday, February 26, 2009
SQL injection
layer of an application. The vulnerability is present when user input is either incorrectly filtered for
string literal escape characters embedded in SQL statements or user input is not strongly typed and thereby
unexpectedly executed. It is in fact an instance of a more general class of vulnerabilities that can occur
whenever one programming or scripting language is embedded inside another.
SELECT * FROM users WHERE name = 'a' OR 't'='t';
x';UPDATE members SET email = 'steve@unixwiz.net' WHERE email = 'bob@example.com
Bypassing Login Screens (SMO+)
SQL Injection 101, Login tricks
* admin' --
* admin' #
* admin'/*
* ' or 1=1--
* ' or 1=1#
* ' or 1=1/*
* ') or '1'='1--
* ') or ('1'='1--
* ....
* Login as different user (SM*)
' UNION SELECT 1, 'anotheruser', 'doesnt matter', 1--
*Old versions of MySQL doesn't support union queries
Ruby -- Faker Gem
Code:
require 'mysql'
require 'faker'
db = Mysql::new("localhost", "root", "", "jazzezravi_development")
i=1
while i < 1000 do
c=Faker::Name.name
c.gsub("'","")
sql = "INSERT INTO batas VALUES(#{i},'#{c}','0','0');"
db.query(sql)
i+=1
end
Types of testing
• White box testing - This test is based on knowledge of the internal design and code. Tests are based on code statements, coding styles, etc.
• unit testing - the most 'micro' scale of testing; to test particular functions or code modules. Typically done by the programmer and not by testers, as it requires detailed knowledge of the internal program design and code. Not always easily done unless the application has a well-designed architecture with tight code, may require developing test driver modules or test harnesses.
• incremental integration testing - continuous testing of an application as new functionality is added; requires that various aspects of an application's functionality be independent enough to work separately before all parts of the program are completed, or that test drivers be developed as needed; done by programmers or by testers.
• integration testing - testing of combined parts of an application to determine if they function together correctly. The 'parts' can be code modules, individual applications, client and server applications on a network, etc. This type of testing is especially relevant to client/server and distributed systems.
• functional testing - black-box type testing geared to functional requirements of an application; this type of testing should be done by testers. This doesn't mean that the programmers shouldn't check that their code works before releasing it (which of course applies to any stage of testing.)
• system testing - black-box type testing that is based on overall requirements specifications; covers all combined parts of a system.
• end-to-end testing - similar to system testing; the 'macro' end of the test scale; involves testing of a complete application environment in a situation that mimics real-world use, such as interacting with a database, using network communications, or interacting with other hardware, applications, or systems if appropriate.
• sanity testing or smoke testing - typically an initial testing effort to determine if a new software version is performing well enough to accept it for a major testing effort. For example, if the new software is crashing systems every 5 minutes, bogging down systems to a crawl, or corrupting databases, the software may not be in a 'sane' enough condition to warrant further testing in its current state.
• regression testing - re-testing after fixes or modifications of the software or its environment. It can be difficult to determine how much re-testing is needed, especially near the end of the development cycle. Automated testing tools can be especially useful for this type of testing.
• acceptance testing - final testing based on specifications of the end-user or customer, or based on use by end-users/customers over some limited period of time.
• load testing - testing an application under heavy loads, such as testing of a web site under a range of loads to determine at what point the system's response time degrades or fails.
• stress testing - term often used interchangeably with 'load' and 'performance' testing. Also used to describe such tests as system functional testing while under unusually heavy loads, heavy repetition of certain actions or inputs, input of large numerical values, large complex queries to a database system, etc.
• performance testing - term often used interchangeably with 'stress' and 'load' testing. Ideally 'performance' testing (and any other 'type' of testing) is defined in requirements documentation or QA or Test Plans.
• usability testing - testing for 'user-friendliness'. Clearly this is subjective, and will depend on the targeted end-user or customer. User interviews, surveys, video recording of user sessions, and other techniques can be used. Programmers and testers are usually not appropriate as usability testers.
• install/uninstall testing - testing of full, partial, or upgrade install/uninstall processes.
• recovery testing - testing how well a system recovers from crashes, hardware failures, or other catastrophic problems.
• failover testing - typically used interchangeably with 'recovery testing'
• security testing - testing how well the system protects against unauthorized internal or external access, willful damage, etc; may require sophisticated testing techniques.
• compatability testing - testing how well software performs in a particular hardware/software/operating system/network/etc. environment.
• exploratory testing - often taken to mean a creative, informal software test that is not based on formal test plans or test cases; testers may be learning the software as they test it.
• ad-hoc testing - similar to exploratory testing, but often taken to mean that the testers have significant understanding of the software before testing it.
• context-driven testing - testing driven by an understanding of the environment, culture, and intended use of software. For example, the testing approach for life-critical medical equipment software would be completely different than that for a low-cost computer game.
• user acceptance testing - determining if software is satisfactory to an end-user or customer.
• Comparison testing - comparing software weaknesses and strengths to competing products.
• alpha testing - testing of an application when development is nearing completion; minor design changes may still be made as a result of such testing. Typically done by end-users or others, not by programmers or testers.
• beta testing - testing when development and testing are essentially completed and final bugs and problems need to be found before final release. Typically done by end-users or others, not by programmers or testers.
• mutation testing - a method for determining if a set of test data or test cases is useful, by deliberately introducing various code changes ('bugs') and retesting with the original test data/cases to determine if the 'bugs' are detected. Proper implementation requires large computational resources.
What is Software Testing?
Software testing is oriented to "detection". It's examining a system or an application under controlled conditions. It's intentionally making things go wrong when they should not and things happen when they should not.
What is Testing?
Ruby -- Array Exercise
What is the output of the following programs
Note : Please find the answers manually
——————————————————–
1. Question 1
@a=[34,45,56,2,13,54]
@a.sort!
@a.reverse
puts @a[4] gives,
a) 13 b)54 c) 45 d) 56
——————————————————–
2. Question 2
@a=[34,45,56,2,13,54]
@a=@a.length.to_a.join
puts @a.class gives,
a) fixNum b)Array c) String d) ERROR
——————————————————–
3. Question 3
@a=[34,45,56,2,13,54]
@a=@a[5,4]
puts @a gives,
a) 13 b)54 c) 45 d) 56
——————————————————–
4. Question 4
@a=[34,45,56,2,13,54]
@a= @a.flatten
puts @a gives,
a) The reverse order b) NIL c) NULL d) Same Order
——————————————————–
5. Question 5
@a=[34,45,56,2,13,54]
@b= @a.min + @a.max + @a.first + @a.last
puts @b gives,
a) 92 b) 144 c) 146 d) 112
——————————————————–
6. Question 6
@a=[34,45,56,2,13,54]
@b= @a[2].value+@a[3].value
puts @b gives,
a) Argument Error b) 58 c) NomethodError d) 0
——————————————————–
7. Question 7
@a=[34,45,56,2,13,54]
@b= @a[2].display.to_i + @a[3].display.to_i
puts @b gives,
a) Error b) 58 c) 5620 d) 562
——————————————————–
8. Question 8
@a=[34,45,56,2,13,54]
@b= @a.rindex(13) + @a.values_at(4)[0]
puts @b gives,
a) Error b) 17 c) 47 d) 7
——————————————————–
9. Question 9
@a=[34,45,56,2,13,54]
@a.insert(6)
@a.insert(6,7)
@a << [137,89]
@b=@a.length
puts @b gives,
a) Error b) 10 c) 9 d) 8
——————————————————–
10. Question 10
@a=[34,45,56,2,13,54]
@b= @a.__id__.class
puts @b gives,
a) Error b) Array c) Nil class d) FixNum
Send your answers as a Comments of this article upto Sunday(Feb28) Result Date: march 1 (List of the names who scored 100%)
Friday, October 3, 2008
Handling log files with Cygwin
How to handle log Files with the help of Cygwin?
The following steps are useful to guide that way,
1. Install Cygwin in your pc
Url: http://www.cygwin.com/mirrors.html
2. Download your production log file.
Ex: I am using FileZilla to download log file. If u want to install Filezilla in ur Pc then got this site and get it.
URL http://sourceforge.net/project/showfiles.php?group_id=21558
3. After getting the production.log file Paste that one to the follwingpath.
c:\cygwin\ home\SYSTEMNAME\(PASTEHERE) production.log
Handling CYGWIN:
Log file contains ..,
Processing ContentController#browse (for 122.164.50.158 at 2007-08-04 00:09:05) [GET]
Session ID: 326960cad4b49605ba7dcf9c33a9c94e
Parameters: {”action”=>”browse”, “controller”=>”content”}
Rendering within layouts/main
Rendering content/browse
Completed in 0.64700 (1 reqs/sec) | Rendering: 0.33623 (51%) | DB: 0.19639 (30%) | 200 OK [http://www.urwords.railsfactory.com/]
Processing UserController#login (for 122.164.50.158 at 2007-08-04 00:09:08) [GET]
Session ID: 326960cad4b49605ba7dcf9c33a9c94e
Parameters: {”action”=>”login”, “controller”=>”user”}
Rendering within layouts/main
Rendering user/login
Completed in 0.03070 (32 reqs/sec) | Rendering: 0.02847 (92%) | DB: 0.00057 (1%) | 200 OK [http://www.urwords.railsfactory.com/user/login]
Error Types
200 means — ok
304 means — not modified
401 means — unauthorized
403 means — forbidden
404 means — file not found
500 means — Application error etc..
Commands:
1. Run cygwin exe
2. all hits with session id
$ grep ‘Session ID:’ production.log
3. unique session g
$ grep ‘Session ID:’ production.log | sort | uniq
4. number of unique sessions
$ grep ‘Session ID:’ production.log | sort | uniq | wc -l
5. usage of session
$ grep ‘Session ID:’ production.log | sort | uniq -c| sort -r
6. get IP info
$ grep ‘Processing’ production.log | cut -d’ ‘ -f4 |sort | uniq -c| sort -r
7. requests per second
$ grep ‘reqs/sec’ production.log | cut -d’ ‘ -f4 |sort | uniq -c| sort -r
$ grep ‘reqs/sec’ production.log | cut -d’ ‘ -f4 |sort | uniq -c| sort -r > speed.txt (Now see ur c:\cygwin\home\pcname\speed.txt file is there. It contains the particular output.)
$ grep ‘reqs/sec’ production.log | cut -d’ ‘ -f4| cut -d’(’ -f2 |sort | uniq -c
8. status errors
$ grep ‘(404 Not Found)’ production.log | wc -l
$ grep ‘(500 Error)’ production.log | wc -l
9. Completed
$ grep ‘Completed’ production.log | cut -d’ ‘ -f17 | cut -d’[' -f2 | cut -d']‘ -f1
$ grep ‘Completed’ p.log | cut -d’ ‘ -f17 | cut -d’[' -f2 | cut -d']‘ -f1 | sort -r | uniq > url.txt
Ya In this way, you will find the status of your product. I think it is very useful to everyone to reduce bugs.
Regards,
P.Raveendran