1 00:00:00,300 --> 00:00:02,400 Writing an essay script. 2 00:00:04,690 --> 00:00:07,570 So Unmap offers group support on many topics. 3 00:00:08,650 --> 00:00:16,930 Now, since it is open source scripts are constantly increasing by the day or even the existing scripts 4 00:00:16,930 --> 00:00:17,900 are improved. 5 00:00:18,800 --> 00:00:22,210 Therefore, that means that you can write your own and map script. 6 00:00:23,000 --> 00:00:28,040 And of course, it may indeed be necessary if you can't find a script that is more relevant to a crawl 7 00:00:28,040 --> 00:00:28,700 that you want to do. 8 00:00:30,450 --> 00:00:37,650 So all information about Intermap scripting engine or NSC can be found here and Map Maddog. 9 00:00:39,850 --> 00:00:44,590 The unmap scripts are written in the Lewa programming language. 10 00:00:46,340 --> 00:00:51,860 If you're not necessarily familiar, I'll tell you that some rules must be followed when writing script. 11 00:00:53,650 --> 00:00:56,080 There are certain parts that must be included in the script. 12 00:00:57,090 --> 00:01:04,650 And this is because Unmap Runge each script in a certain sequence, starting from the first line of 13 00:01:04,650 --> 00:01:08,960 the script, it'll run step by step according to the rules. 14 00:01:09,960 --> 00:01:13,010 So a script that is not written correctly will fail. 15 00:01:14,560 --> 00:01:19,100 So when writing scripts with N Map, we don't have to write everything ourselves. 16 00:01:19,930 --> 00:01:27,850 There is an API support, which means that many processes that we will be using are already defined 17 00:01:27,850 --> 00:01:28,420 and in MAP. 18 00:01:29,340 --> 00:01:34,410 And we need to do is call the relevant process with the help of the and map API. 19 00:01:37,790 --> 00:01:42,740 So you can access the unmap API libraries at this site. 20 00:01:46,250 --> 00:01:54,740 Now, the NSC script consists of the following main pains, the head description categories, dependencies, 21 00:01:54,770 --> 00:01:55,850 author and Lycett. 22 00:01:56,940 --> 00:01:57,990 Description feel. 23 00:01:59,510 --> 00:02:03,480 The description field tells the subject of the script and what it does. 24 00:02:05,090 --> 00:02:09,860 Depending on the length and complexity of the script, the description can be several lines. 25 00:02:11,480 --> 00:02:14,290 I think a brief summary would often be more understandable. 26 00:02:16,290 --> 00:02:17,250 Categories. 27 00:02:19,110 --> 00:02:25,080 So the fields that the script is included in our specify, so one or more fields can be included. 28 00:02:26,010 --> 00:02:28,730 There's no case sensitivity when specifying names. 29 00:02:30,330 --> 00:02:34,890 Four domains you can go to and mayberg at this address. 30 00:02:37,250 --> 00:02:39,140 For example, categories equals. 31 00:02:40,100 --> 00:02:42,000 Default, discovery, safe, et cetera. 32 00:02:44,590 --> 00:02:53,290 Author field information about the person who wrote the script using an email address is not recommended. 33 00:02:55,320 --> 00:02:55,930 License for. 34 00:02:57,330 --> 00:03:04,190 The license information is required to use a script and all scripts use and map licenses because an 35 00:03:04,200 --> 00:03:06,330 map is open source software. 36 00:03:08,240 --> 00:03:10,940 So it's sufficient to specify the following in the script. 37 00:03:11,820 --> 00:03:14,520 License equals same as Inmet. 38 00:03:17,120 --> 00:03:19,940 So you can look at this page to get that. 39 00:03:24,410 --> 00:03:25,580 Dependancy Fields'. 40 00:03:26,650 --> 00:03:33,460 So if there is another script in this field that will be used beforehand, before the execution of the 41 00:03:33,460 --> 00:03:35,650 script, it's going to be specified here. 42 00:03:37,360 --> 00:03:42,910 So when writing scripts, you should list the scripts that should work in advance, according to the 43 00:03:42,910 --> 00:03:48,790 scenario that we have determined, for example, dependencies equals SMB boot. 44 00:03:51,120 --> 00:03:51,690 The rule. 45 00:03:52,870 --> 00:03:56,740 The rules that will be executed in the script here are specified. 46 00:03:58,140 --> 00:04:03,830 Rules are Lua commands that run in sequence and return true or false? 47 00:04:04,980 --> 00:04:10,160 So a script must contain one or more of the following functions that determine when to run the script. 48 00:04:11,750 --> 00:04:12,860 Free Rule A. 49 00:04:14,420 --> 00:04:16,520 Just rule the host. 50 00:04:18,020 --> 00:04:22,670 What rule host port and post rule A? 51 00:04:24,050 --> 00:04:33,260 So pretty rule scripts are executed once before any host is scanned in the script pre scan phase. 52 00:04:34,320 --> 00:04:38,160 So after each host is scanned, the hosts rule, import rule scripts are executed. 53 00:04:40,320 --> 00:04:44,400 Most rural scripts run once, after all, the hosts are scanned. 54 00:04:45,870 --> 00:04:49,560 And a script can run in multiple stages if it has several rules. 55 00:04:51,380 --> 00:04:54,620 Pretty rule and post rule do not accept arguments. 56 00:04:56,790 --> 00:05:03,720 Host rule accepts a host table and can, for example, test the IP address or host name of the destination 57 00:05:04,740 --> 00:05:13,080 port rule open open except support table for any port and filtered or unfiltered port states. 58 00:05:15,070 --> 00:05:22,030 Court rules often test factors such as port no port status or listening service name when deciding a 59 00:05:22,030 --> 00:05:22,390 port. 60 00:05:24,540 --> 00:05:28,440 And some example rules are shown in the section entitled Rule. 61 00:05:31,000 --> 00:05:35,110 The standard to choose between a pre rule or a post rule is. 62 00:05:36,180 --> 00:05:43,980 If this script is doing computer discovery or other network operation, then the rule should be use. 63 00:05:45,580 --> 00:05:50,710 Most rule is reserved for reporting, data and statistics collected during scanning. 64 00:05:55,620 --> 00:05:56,280 The action. 65 00:05:57,570 --> 00:06:00,620 Action is the heart of an NSC script. 66 00:06:01,790 --> 00:06:08,450 The script preparation includes all instructions that must be executed in the courtroom, host rule 67 00:06:08,450 --> 00:06:10,250 or post rule triggers. 68 00:06:12,720 --> 00:06:15,900 A Lua function that accepts the same arguments as a rule. 69 00:06:17,750 --> 00:06:24,530 The value returned by the action value can be a table of name value pairs, a string or a zero. 70 00:06:26,390 --> 00:06:32,000 Environment variables, so each script has its own set of environment variables. 71 00:06:32,990 --> 00:06:40,970 Script path, obviously, the script path, script name is the name, and this variable can be used 72 00:06:40,970 --> 00:06:42,230 in a debug output. 73 00:06:43,290 --> 00:06:45,180 Script type two. 74 00:06:46,150 --> 00:06:50,620 So since a script can have more than one rule function. 75 00:06:51,810 --> 00:06:58,020 This environment variable indicates which rule has enabled the script, which is very useful if the 76 00:06:58,020 --> 00:07:01,890 script wants to share some code between different script scanning phases. 77 00:07:06,280 --> 00:07:08,800 So how about some examples, scriptwriting? 78 00:07:10,430 --> 00:07:13,640 Now, that's a great example, script and then scan with a script. 79 00:07:15,450 --> 00:07:21,750 So let's write a script to show if the DNA sport is on or off. 80 00:07:23,390 --> 00:07:30,800 So the script must be registered in this directory in order to be used by the unmap program. 81 00:07:33,280 --> 00:07:44,260 So open VMS, open login, actually, user root password tours, open terminal now right in leaf pad, 82 00:07:44,380 --> 00:07:48,910 user share and map scripts test that NFC. 83 00:07:51,310 --> 00:07:53,740 Of course, you can use it in another text editor. 84 00:07:56,290 --> 00:08:00,310 Will will speed up by using the the notes I've prepared before. 85 00:08:01,960 --> 00:08:03,310 So versus right head. 86 00:08:04,620 --> 00:08:05,820 Description equals. 87 00:08:06,980 --> 00:08:12,260 So this is a simple script example that determines if a DNS port is open or not. 88 00:08:12,290 --> 00:08:12,530 Right. 89 00:08:13,070 --> 00:08:14,900 Author equals non byte. 90 00:08:18,000 --> 00:08:26,130 Now, let's right rule, so here our script will scan unless DP and UDP ports on the target system rule. 91 00:08:27,450 --> 00:08:30,240 What rule equals function of support? 92 00:08:31,400 --> 00:08:41,180 Return port, that protocol equals equals TCP and port, not state equals equals open. 93 00:08:42,120 --> 00:08:50,160 Return port protocol equals equals UDP and Port St. equals equals open and. 94 00:08:52,460 --> 00:08:54,910 So an action will list the results. 95 00:08:55,970 --> 00:09:02,840 Action equals function Mooseport return, this port is open. 96 00:09:05,890 --> 00:09:15,350 So this record, what we do now, so on the command line and map script test 10 zero two dot four p. 97 00:09:15,350 --> 00:09:19,490 53 us, you just press enter. 98 00:09:21,600 --> 00:09:25,380 OK, so as you can see, our script works and the results were listed. 99 00:09:27,810 --> 00:09:34,250 So the subject of scripts is completely dependent on your programming, knowledge and your imagination. 100 00:09:35,500 --> 00:09:41,620 So if you define what you want to do, you will have completed really the most important stage. 101 00:09:42,820 --> 00:09:44,500 The Internet's going to help you with the rest. 102 00:09:44,530 --> 00:09:46,150 Well, I'll help you with this anyway. 103 00:09:47,120 --> 00:09:51,140 So remember, you can always contribute to Inmet by sharing your scripts.