Post

Introduction to Scripting

Scripting Overview

History of Scripting

  • IBM’s Job Control Language (JCL) was the first scripting language.
  • Many batch jobs require setup, with specific requirements for main storage, and dedicated devices such as magnetic tapes, private disk volumes, and printers set up with special forms.
  • JCL was developed as a means of ensuring that all required resources are available before a job is scheduled to run.
  • The first interactive shell was developed in the 1960s.
  • Calvin Mooers in his TRAC language is generally credited with inventing command substitution, the ability to embed commands in scripts that when interpreted insert a character string into the script.
  • One innovation in the UNIX shells was the ability to send the output of one program into the input of another, making it possible to do complex tasks in one line of shell code.

Script Usage

  • Scripts have multiple uses, but automation is the name of the game.
  • Image rollovers
  • Validation
  • Backup
  • Testing

Scripting Concepts

  • Scripts
    • Small interpreted programs
    • Script can use functions, procedures, external calls, variables, etc.
  • Variables
  • Arguments/Parameters
    • Parameters are pre-established variables which will be used to perform the related process of our function.
  • If Statement
  • Loops
    • For Loop
    • While Loop
    • Until Loop

Scripting Languages

JavaScript

  • Object-oriented, developed in 1995 by Netscape communications.
  • Server or client side use, most popular use is client side.
  • Supports event-driven functional, and imperative programming styles. It has APIs for working with text, arrays, dates, regular expression, and the DOM, but the language itself doesn’t include any I/O, such as networking, storage, or graphics facilities. It relies upon the host environment in which it is embedded to provide these features.

Bash

  • UNIX shell and command language, written by Brian Fox for the GNU project as a free software replacement for the Bourne shell.
  • Released in 1989.
  • Default login shell for most Linux distros.
  • A command processor typically runs in a text window, but can also read and execute commands from a file.
  • POSIX compliant

Perl

  • Larry Wall began work on Perl in 1987.
  • Version 1.0 released on Dec 18, 1987.
  • Perl2 – 1988
  • Perl3 – 1989
  • Originally, the only documentation for Perl was a single lengthy man page.
  • Perl4 – 1991

PowerShell

  • Task automation and configuration management framework
  • Open-sourced and cross-platformed on 18 August 2016 with the introduction of PowerShell Core. The former is built on .NET Framework, while the latter on .NET Core.

Binary

Binary code represents text, computer processor instructions, or any other data using a two-symbol system. The two-symbol used is often “0” and “1” from the binary number system.

Adding a binary payload to a shell script could, for instance, be used to create a single file shell script that installs your entire software package, which could be composed of hundreds of files.

Hex

Advanced hex editors have scripting systems that let the user create macro like functionality as a sequence of user interface commands for automating common tasks. This can be used for providing scripts that automatically patch files (e.g., game cheating, modding, or product fixes provided by the community) or to write more complex/intelligent templates.

Python Scripting

Benefits of Using Python

  • Open Source
  • Easy to learn and implement
  • Portable
  • High level
  • Can be used for almost anything in cybersecurity
  • Extensive libraries

    Python Libraries

    Introduction to Scripting

This post is licensed under CC BY 4.0 by the author.