Skip to content

pamoroso/stringscope

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

28 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Stringscope

Stringscope is a tool to display a list of the text strings contained in a binary file, i.e. the sequences of printable characters longer than a minimum threshold of 4 characters. The program, which is written in and runs under Medley Interlisp, is similar to the Unix tool strings.

Stringscope output window

Installation

Download the file STRINGSCOPE from the project repo, copy it to a file system location your Medley Interlisp installation has access to, and optionally compile the source by evaluating the following expression from the Lisp executive:

(TCOMPL 'STRINGSCOPE)

Provide these answers to the questions the compiler asks:

  • listing? no
  • redefine? yes
  • save exprs? no

Finally, to load the program evaluate:

(FILESLOAD STRINGSCOPE)

Usage

Once Stringscope is loaded you can call the following functions and commands.

STRINGSCOPE

To run the program evaluate:

(STRINGSCOPE FILENAME MIN.LEN)

where FILENAME is a file name and MIN.LEN the optional minimum length printable character sequences must have. The default is 4 characters but is user-configurable by changing the global variable SSCOPE.MIN.LEN.

STRINGSCOPE prompts to create a window to display the output, which is scrollable. The output window has a prompt area attached to the top side and a menu to the right side. The prompt area serves for requesting input and displaying status messages, the menu contains the following items and subitems:

  • Info: shows statistics about the strings
  • Get: reads the strings of a new file
  • Find: searches for strings matching a specified text (case insensitive)
  • Sort: sorts the strings in the following order
    • Ascending
    • Descending
  • Min Len: changes the minimum length strings must have
  • Reset: redisplays the strings read from the current file
  • Exit: quits the program

The function returns the output window if the file is processed with no issues, NIL otherwise.

STRINGS

To make the program print the strings to the primary output stream call the function STRINGS, which takes the same arguments as STRINGSCOPE and the additional optional argument NEWWIN:

(STRINGS FILENAME MIN.LEN NEWWIN)

If NEWWIN is not NIL, STRINGS works exactly like STRINGSCOPE and displays the output in a new window. Depending on the value of NEWWIN, STRINGS returns the primary output stream or the new window if the file is processed with no issues, NIL otherwise.

STRINGS is available also as an Executive command which accepts the same first two arguments and prints the output:

STRINGS FILENAME MIN.LEN

EXTRACT.STRINGS

The function:

EXTRACT.STRINGS STREAM MIN.LEN

returns a list of the strings of at least MIN.LEN characters read from STREAM. The function assumes the input stream is already open.

Release history

See the list of releases for notes on the changes in each version.

Learn more

Author

Stringscope is developed by Paolo Amoroso.

License

This code is distributed under the MIT license, see the LICENSE file.