Lesson 15 - Scripting and Software Development Flashcards

1
Q

List some common bash commands

A

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

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

What does Powershell function using.

A

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!”

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

What is the key difference between Bash and Powershell vs a programming language such as Python

A

Python is not a command shell tied to the OS.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

T or F Python runs as an exutable

A

False
It runs within an executable environment and must be activated when the script is run

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

Describe Python syntax vs other dev languages such as Java

A

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 well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

How is Ruby similar and different from Python

A

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

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

What is the general purpose interpreted programming language used in the late eighties in Unix that can also be used for scripting

A

!/usr/bin/perl

Perl

use strict;
use warnings;

print “Hello, World!\n”;

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

Scripting Language used alongside HTML and CSS for WWW

A

Javascript
Uses brackets
<!DOCTYPE html>

<html>
<body>
<h2>Web Page</h2>
<p>Paragraph.</p>

<script>
window.alert("Hello World!");
</script>

</body>
</html>
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

Identify the languages based on variables
my_str = “Hello, World!”

$my_str = “Hello, World!”;

var my_str = “Hello, World!”;

A

Python or Rub

Perl Variables

Javascript - variable must be declared

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

What is term for the script logic and how instructions are executed and what is the common example(s) using what type of statement

A

Flow Control

If Statements- conditional

Loop - while loop

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

What are the 3 most common operators used for scripting

A

Boolean
my_var =1

Arithmetic
val1 =10 , val2=2
Val3 = val1 + val2

String - val1 = “hello”

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

What is the open standard data encoding format that is used for manipulating within scripts and works very well into Python Dictionaires

A

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”]}

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

What in Object Orientated Programming is used for producing modular and reusable code

A

Functions or Procedures

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

What is a user defined prototype or template from which objects can be created

A

Classes - creates user-defined data structures which can hold their own function

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

What is the purpose of Modules and Libraries and how does Python utilize them

A

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

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q
A