C-Kermit Scripting Tutorial and Library:

https://kermitproject.org/ckscripts.html

Useful Options:

--unbuffered Force unbuffered console i/o.

--nolocale Disable use of locale for messages and strings.

--noperms Disable file-transfer Permissions attribute.

--nointerrupts Disable keyboard interrupts.

--nopush Disable external command execution.

--timeout: [IKSD only] How long to wait for login before closing the connection.

--termtype:name Choose terminal type.

--rcharset:name Name of remote terminal character set.

--user:name Username.

Useful Commands:

  • SHOW FEATURES: to see what might have been excluded when build or unavailable on certain platforms.
  • "Ctrl + \ + C" to break current blocking operations(hold down the "Ctrl" key and press then "" key then "C" key);
  • ?: get a list of all C-Kermit's commands, type a question mark (?) at the prompt.
  • HELP To get a description of any command, for example: help send
  • (backslash) is escape character", used to introduce variable names, function invocations, and so on. If you need to include a literal backslash in a command, type two of them, e.g.: get c:\\k95\\k95custom.ini . It also introduces variable names and calls to built-in functions.

Getting Help within a Command

A question mark (?), typed at any point in a command, produces a message explaining what is possible or expected at that point. Depending on the context, the message can be a brief explanatory phrase, a menu of valid keywords, or a list of files.

  • If you type a question mark at the prompt, you’ll see a list of all C-Kermit’s top-level commands.
  • If you type a letter s at the prompt and then question mark, Kermit lists the commands that start with s:

C-Kermit>s? Command, one of the following:

save server sleep status switch screen set sort stop

script sexpressionspace succeed

search shift spawn support

send show statisticssuspend

C-Kermit>s

After the menu or help message is displayed, you can continue the command from where you left off. The s is still there, and now you can type a letter e and another question mark to see which commands start with se:

C-Kermit>se? Command, one of the following:

search send server set sexpression

C-Kermit>set

INITIALIZATION FILE

When you start C-Kermit, it executes commands from an initialization file in your home directory unless it is given the -Y or -y command-line option.

Platform Filename Location
Unix:Linux,macOS,BSD,etc .kermrc Your home (login) dir.
MS Windows k95custom.ini \v(appdata) (your app. data dir.)
IBM OS/2 k2custom.ini \v(appdata) (your app. data dir.)
VMS, OpenVMS ckermit.ini Your home (login) dir.
Other ckermit.ini Your home (login) dir.

Your initialization file can contain any Kermit commands at all, as well as comments.

A typical use would be to define macros that you want to be able to execute whenever you're using C-Kermit.

To remind you that it's being executed you might want to include a line like this in it:

echo C-Kermit \v(fullversion) executing \v(cmdfile)...

  • Command Files, Macros, and Scripts

    A file containing Kermit commands is called a Kermit command file or Kermit script.

    It can be executed with Kermit's TAKE command:
(/current/dir) C-Kermit> take commandfile
(where "commandfile" is the name of the command file).

In Unix only, a Kermit command file can also be executed directly by including a "kerbang" line as the first line of the file:

#!/usr/local/bin/kermit +

That is, a top line that starts with "#!", followed immediately by the full path of the Kermit executable, and then, if the Kermit script is to be given arguments on the command line, a space and a plus sign. The script file must also have execute permission:

chmod +x commandfile

COMMAND LINE:

Finally, if Kermit's first command-line option is a Telnet, FTP, IKSD, or HTTP URL,

Kermit automatically makes the appropriate kind of connection and, if indicated by the URL, takes the desired action:

kermit telnet:xyzcorp.com ; Opens a Telnet session

kermit telnet://olga@xyzcorp.com ; Ditto for user olga

kermit ftp://olga@xyzcorp.com/public/somefile.zip ; Downloads a file

kermit kermit://kermit.columbia.edu/kermit/f/READ.ME ; Ditto for IKSD

kermit iksd://kermit.columbia.edu/kermit/f/READ.ME ; (This works too)

kermit https://kermitproject.org/index.html ; Grabs a web page

kermit https://wwws.xyzcorp.com/secret/plan.html ; Grabs a secure web page

  • COMMAND-LINE OPTIONS
Usage:
1. kermit [filename] [-x arg [-x arg]...[-yyy]..] [ {=,--,+} text ] ]
2. kermit URL
-x is an option requiring an argument;
-y is an option with no argument.
  • If the first argument is the name of a file, interactive-mode commands are executed from the file.
  • The '=' (or "--") argument tells Kermit not to parse the remainder of the command line, but to make the words following '=' available as %1, %2, ... %9.
  • The "+" argument is like "=" but for use in "kerbang scripts" (explained below).
  • A second command-line format allows the one and only argument to be a Telnet, FTP, HTTP, or IKSD URL.

Order of Execution:

  1. The command file (if any).
  2. The initialization file, if any, unless suppressed with -Y.
  3. The customization file (if it is executed by the initialization file).
  4. The command-line URL (if any, and if so, execution stops here).
  5. Command-line options (if any).
  6. Interactive commands.

Some cmd.line options can cause actions(such as -s); others just set parameters.

  • Kermit exits when finished unless also given the -S ("stay") option, If any action options are included on the cmd. line, .
  • Kermit issues its prompt and waits for you to type commands, If no action options are given, no initialization or command files contained an EXIT or QUIT command, and no fatal errors occurred.

C-Kermit Invocation:

$ kermit -s ckermit.tar.gz

('$' is the shell prompt; kermit -s ckermit.tar.gz is what you type, followed by Return or Enter.)

C-Kermit has three kinds of commands:

  • regular single-letter command-line options,
  • extended-format command-line options,
  • interactive commands.

regular single-letter command-line options

Like most Unix commands, C-Kermit can be be given options on the command line.

In other words, you don't have to use C-Kermit's command-line options, but they are available if you want to.

By the same token, you don't have to use its interactive commands either -- you can use either or both in any combination.

Here is a list of C-Kermit's single-letter command-line options, which start with a single dash (-), in ASCII ("alphabetical") order. Alphabetic case is significant (-A is not the same as -a). The Action column contains **Y for action options **and N for non-action options.

Option Action Description
-0 N 100% transparent Connect state for "in-the-middle" operation: 8 bits, no parity, no escape character, everything passes through.
-8 N Connection is 8-bit clean (this is the default in C-Kermit 9.0 and later). Equivalent to the EIGHTBIT command, which in turn is a shortcut for SET TERMINAL BYTESIZE 8, SET COMMAND BYTESIZE 8, SET PARITY NONE.
-9 arg N (digit nine) Make a connection to an FTP server. Equivalent to the FTP OPEN command. Argument: IP-address-or-hostname[:optional-TCP-port]. NOTE: C-Kermit also has a separate FTP command-line personality, with regular FTP-like command-line syntax. More about this below.
-A N Kermit is to be started as an Internet service (IKSD) (only from inetd.conf).
-B N Kermit is running in Batch or Background (no controlling terminal). To be used in case Kermit doesn't automatically sense its background status. Equivalent to the SET BACKGROUND ON command.
-C arg N Interactive-mode Commands to be executed. Argument: Commands separated by commas, list in doublequotes.
-D arg N Delay before starting to send in Remote mode. Equivalent to the SET DELAY command. Argument: Number of seconds.
-E N Exit automatically when connection closes. Equivalent to SET EXIT ON-DISCONNECT ON.
-F arg N Use an open TCP connection.
-G arg Y Get file(s) from server, send contents to standard output, which normally would be piped to another process. Argument: Remote file specification, in quotes if it contains metacharacters. Also see: -g, -k.
-H N Suppress program startup Herald and greeting.
-I N Tell Kermit it has a reliable connection, to force streaming to be used where it normally would not be. Equivalent to the SET RELIABLE ON command.
-J arg N "Be like Telnet." Like -j but implies -E. Argument: IP hostname/address optionally followed by service. NOTE: C-Kermit also has a separate Telnet command-line personality, with regular Telnet-like command-line syntax. More about this below.
-L N Recursive directory descent for files in -s option.
-M arg N My user name (for use with Telnet, Rlogin, FTP, etc). Equivalent to the SET LOGIN USER command. Argument: Username string.
-O Y (Uppercase letter O) Be a server for One command only. Also see: -x.
-P N Don't convert file (Path) names of transferred files. Equivalent to SET FILE NAMES LITERAL.
-Q N Quick Kermit protocol settings. Equivalent to the FAST command. This is the default in C-Kermit 7.0 and later.
-R N Remote-only (this just makes IF REMOTE true).
-S N Stay (enter command parser after action options).
-T N Force Text mode for file transfer; implies -V. Equivalent to SET TRANSFER MODE MANUAL, SET FILE TYPE TEXT.
-V N Disable automatic per-file text/binary switching. Equivalent to SET TRANSFER MODE MANUAL.
-Y N Skip (don't execute) the initialization file.
-a arg N As-name for file(s) in -s, -r, or -g. Argument: As-name string (alternative filename). When receiving files, this can be a directory name.
-b arg N Speed for serial device. Equivalent to SET SPEED.

C-Kermit has hundreds of commands, and they can be issued in infinite variety and combinations, including commands for:

  • Making connections (SET LINE, DIAL, TELNET, SSH, FTP, CONNECT, ...)
  • Breaking connections (HANGUP, CLOSE)
  • Transferring files (SEND, GET, RECEIVE, MOVE, RESEND, ...)
  • Establishing preferences (SET)
  • Displaying preferences (SHOW)
  • Managing local files (CD, DELETE, MKDIR, DIRECTORY, RENAME, TYPE, COPY, TOUCH, ...)
  • Managing remote files (RCD, RDEL, RMKDIR, RDIR, ...)
  • Using local files (FOPEN, FCLOSE, FREAD, FWRITE)
  • Programming (TAKE, DEFINE, IF, FOR, WHILE, SWITCH, DECLARE, ...)
  • Interacting with the user (ECHO, ASK, ...)
  • Interacting with a remote computer (INPUT, OUTPUT, ...)
  • Interacting with local programs (RUN, EXEC, PTY, ...)
  • Logging things (LOG SESSION, LOG PACKETS, LOG DEBUG, ...)
  • And of course QUIT or EXIT to get out
  • HELP to get help,
  • and for programmers:
    • variables, arrays, associative arrays, integer and floating point arithmetic,
    • loops, decision making,
    • macros, built-in and user-defined functions, string manipulation, pattern matching, block structure, scoping, recursion, and all the rest.
  • To get a list of all C-Kermit's commands, type a question mark (?) at the prompt.
  • To get a description of any command, type HELP followed by the name of the command, for example: help send
  • The command interruption character is Ctrl-C (hold down the Ctrl key and press the C key).
  • The command language "escape character" is backslash (), used to introduce variable names, function invocations, and so on. If you need to include a literal backslash in a command, type two of them, e.g.: get c:\\k95\\k95custom.ini . It also introduces variable names and calls to built-in functions.

C-Kermit Scripting Tutorial and Library的更多相关文章

  1. [转]Building a Basic Fuzzer with GDB: The Five Minute GDB Scripting Tutorial

    link:http://www.praetorian.com/blog/building-a-basic-fuzzer-with-gdb-the-five-minute-gdb-scripting-t ...

  2. Linux Shell Scripting Tutorial (LSST) v2.0

    http://bash.cyberciti.biz/wiki/index.php?title=Main_Page

  3. Shell Scripting 笔记

    Shell Scripting Tutorial Variables in the Bourne shell do not have to be declared, as they do in lan ...

  4. linux 大法

    实验楼 练习 小笔记 可以输出图形字符的命令banner 你可以先使用如下命令安装: $ sudo apt-get update $ sudo apt-get install sysvbanner 然 ...

  5. Shell脚本编程30分钟入门

    Shell脚本编程30分钟入门 转载地址: Shell脚本编程30分钟入门 什么是Shell脚本 示例 看个例子吧: #!/bin/sh cd ~ mkdir shell_tut cd shell_t ...

  6. Chapter 5: Design and implement security

    Configure authentication Authenticating users IIS authentication Anonymous ASP.net impersonation Bas ...

  7. [转]Shell中read的常用方式

    原文:Linux Shell Scripting Tutorial V2.0 read命令的语法: read -p "Prompt" variable1 variable2 var ...

  8. 《信息安全系统设计基础》第一次实验报告--Linux 基础入门

    北京电子科技学院(BESTI) 实     验    报     告 课程:信息安全设计基础 班级:1352  姓名:何伟钦  学号:20135223 成绩:            指导教师:娄嘉鹏 ...

  9. Linux 读书笔记 一

    一.Linux 简介 实验介绍 本节主要介绍 Linux 的历史,Linux 与 Windows 的区别等入门知识.如果你已经有过充分的了解,可以跳过本节,直接进入下一个实验. 一.Linux 为何物 ...

  10. Awesome Python

    Awesome Python  A curated list of awesome Python frameworks, libraries, software and resources. Insp ...

随机推荐

  1. centos 7.8下载地址

    随着7.9版本的正式版本的发布,7.8.2003版本逐渐被各大镜像站替换,取消. 7.8.2003版本的可以自行在华中科技大学的镜像站下载,这个地址也可能随时会失效,如果失效了同学们可以自行百度搜寻. ...

  2. Apache Druid RCE漏洞复现及修复(CVE-2023-25194)

    Apache Druid RCE漏洞复现及修复(CVE-2023-25194) 2023-03-16 声明:本文分享的安全工具和项目均来源于网络,漏洞环境本地搭建,仅供安全研究与学习,如用于其他用途, ...

  3. 初见 cmake

    初见 cmake cmake 是自动生成构建系统的一个工具.cmake 本身不是构建系统,它是一个生成构建系统的工具.或者说 cmake 不是一个构建工具,是一个能根据平台生成对应平台构建系统配置的构 ...

  4. Wan2.1 t2v模型Lora Fine-Tune

    Wan2.1 t2v模型Lora Fine-Tune 1. Wan2.1模型 Wan2.1是由阿里巴巴开源的AI视频生成大模型,具备强大的视觉生成能力,支持文本到视频(T2V)和图像到视频(I2V)任 ...

  5. Flutter开发的高效图片压缩工具:让APP更加丝滑

    @charset "UTF-8"; .markdown-body { line-height: 1.75; font-weight: 400; font-size: 15px; o ...

  6. 面试官说又逮到一个不会用Git的

    这里这写简要,要看具体的步骤及解释清移步:https://www.bilibili.com/read/cv10510952 如果是自己创建仓库写代码上传(demo是自己仓库的自定义名字): git i ...

  7. javax.validation @Valid注解实现参数校验

      在 RESTful 的接口服务中,存在各种各样的请求参数.在跳入业务处理环节之前,通常会有一个基础的数据验证的机制,待验证通过,结果无误后,请求参数才会传递到正式的业务处理中. maven 依赖引 ...

  8. NSDictionary 内存布局

    NSDictionary是iOS开发中经常用到的数据结构. 熟悉NSDictionary的内部实现,有助于我们更好的使用它们. 同时,在遇到相关崩溃,也能帮助我们更好的分析问题. 1 类簇 非可变字典 ...

  9. 2024杭电钉耙1-1003 HDOJ7435 树

    本文同步发布于我的网站 Problem 给一棵根为 1 的有根树,点 \(i\) 具有一个权值 \(A_i\) . 定义一个点对的值 \(f(u, v)=\max \left(A_u, A_v\rig ...

  10. Java IO<5>管道流PipedOutputStream PipedInputStream

    在java中,PipedOutputStream和PipedInputStream分别是管道输出流和管道输入流.它们的作用是让多线程可以通过管道进行线程间的通讯.在使用管道通信时,必须将PipedOu ...