Lesson 15 - Scripting and Software Development Flashcards
List some common bash commands
Echo- print message
Grep
pwd - print work dir
ls - list files -l long format
Cat - display files
grep “Administrator” /root/dumps/winsrv_hash_dump.txt | cut -d “:” -f3-4 > admin-hash.txt
What does Powershell function using.
Used of cmdlets which are specialized .NET commands that interface with Powershell
Write-Host “Clearing event log…”
Clear-EventLog -logname Security, Application -computername Server01
Write-Host “Event log cleared!”
What is the key difference between Bash and Powershell vs a programming language such as Python
Python is not a command shell tied to the OS.
T or F Python runs as an exutable
False
It runs within an executable environment and must be activated when the script is run
Describe Python syntax vs other dev languages such as Java
Uses whitespace and blocks of code are terminated with indentation rather than curly brackets - also case sensitive
print “Detecting OS…”
if sys.platform == “linux”:
print “Linux system detected!”
How is Ruby similar and different from Python
both are first programming languages
both can be used as a scripting language
Not as common in Pentesting as Python since Python is faster
Similar syntax but does not require whitespace and uses line breaks and is more flexible than Python
puts “Detecting OS…”
if RUBY_PLATFORM == “x86_64-linux-gnu”
puts “Linux system detected!”
end
What is the general purpose interpreted programming language used in the late eighties in Unix that can also be used for scripting
!/usr/bin/perl
Perl
use strict;
use warnings;
print “Hello, World!\n”;
Scripting Language used alongside HTML and CSS for WWW
Javascript
Uses brackets
<!DOCTYPE html>
<html>
<body>
<h2>Web Page</h2>
<p>Paragraph.</p>
<script> window.alert("Hello World!"); </script>
</body>
</html>
Identify the languages based on variables
my_str = “Hello, World!”
$my_str = “Hello, World!”;
var my_str = “Hello, World!”;
Python or Rub
Perl Variables
Javascript - variable must be declared
What is term for the script logic and how instructions are executed and what is the common example(s) using what type of statement
Flow Control
If Statements- conditional
Loop - while loop
What are the 3 most common operators used for scripting
Boolean
my_var =1
Arithmetic
val1 =10 , val2=2
Val3 = val1 + val2
String - val1 = “hello”
What is the open standard data encoding format that is used for manipulating within scripts and works very well into Python Dictionaires
JSON - java script object notation.
{“name”:”phil”}
Keys must be text in double quotes. Strings must be included in double quotes. Data must be separated by commas. If the data is an object, it must be bounded by curly brackets. In fact, all JSON data has at least one curly bracket set. If an array is used, square brackets must be used.
In the example above, you see a string. Numbers can also be used:
{“age”:25}
Things can get complex as an object can contain other object types:
{“man”:{“name”:”phil”, “age”:25}}
Arrays can also be used:
{“friends”:[“Henry”, ”Annmarie”, “Amy”]}
What in Object Orientated Programming is used for producing modular and reusable code
Functions or Procedures
What is a user defined prototype or template from which objects can be created
Classes - creates user-defined data structures which can hold their own function
What is the purpose of Modules and Libraries and how does Python utilize them
Modules are a way to code re-usable functions, variables and classes that can be imported in your scripts
Python has built in libraries already coded. Example would be GitHub and import function