forked from s0m30ne/pymsf
-
Notifications
You must be signed in to change notification settings - Fork 0
/
msf_api.txt
1698 lines (1380 loc) · 69.6 KB
/
msf_api.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
auth 认证相关,用于远程连接msf时的认证
console 终端相关,用于创建于销毁终端以及与终端的命令交互
core 内核相关,用于全局性的一些设置
db 数据库相关,用于存储与查询使用过程中的各种数据
job 任务相关,对任务的开启与停止或查询当前任务信息
module 模块相关,对msf各模块信息的查询与配置
plugin 插件相关,对相关插件的管理
session 会话相关,对会话信息的管理
auth:
rpc.call('auth.login_noauth', username, password)
Handles client authentication. The authentication token will expire 5 minutes after the last request was made.
@param [String] user The username.
@param [String] pass The password.
@raise [Msf::RPC::Exception] Something is wrong while authenticating, you can possibly get:
* 401 Failed authentication.
@return [Hash] A hash indicating a successful login, it contains the following keys:
* 'result' [String] A successful message: 'success'.
* 'token' [String] A token for the authentication.
@example Here's how you would use this from the client:
rpc.call('auth.login_noauth', 'msf', 'msf123')
This returns something like the following:
{"result"=>"success", "token"=>"TEMPyp1N40NK8GM0Tx7A87E6Neak2tVJ"}
rpc.call('auth.logout', token)
Handles client deauthentication.
@param [String] token The user's token to log off.
@raise [Msf::RPC::Exception] An error indicating a failed deauthentication, including:
* 500 Invalid authentication token.
* 500 Permanent authentication token.
@return [Hash] A hash indiciating the action was successful. It contains the following key:
* 'result' [String] The successful message: 'success'
@example Here's how you would use this from the client:
rpc.call('auth.logout', 'TEMPyp1N40NK8GM0Tx7A87E6Neak2tVJ')
This returns something like:
{"result"=>"success"}
rpc.call('auth.token_list')
temporary, permanent, or stored in the backend.
@return [Hash] A hash that contains a list of authentication tokens. It contains the following key:
* 'tokens' [Array<string>] An array of tokens.
@example Here's how you would use this from the client:
rpc.call('auth.token_list')
This returns something like:
{"tokens"=>["TEMPf5I4Ec8cBEKVD8D7xtIbTXWoKapP", "TEMPtcVmMld8w74zo0CYeosM3iXW0nJz"]}
rpc.call('auth.token_add', token)
Adds a new token to the database.
@param [String] token A unique token.
@return [Hash] A hash indicating the action was successful. It contains the following key:
* 'result' [String] The successful message: 'success'
@example Here's how you would use this from the client:
rpc.call('auth.token_add', 'UNIQUE_TOKEN')
This returns something like:
{"result"=>"success"}
rpc.call('auth.token_generate')
database as a side-effect.
@return [Hash] A hash indicating the action was successful, also the new token.
It contains the following keys:
* 'result' [String] The successful message: 'success'
* 'token' [String] A new token.
@example Here's how you would use this from the client:
rpc.call('auth.token_generate')
This returns something like:
{"result"=>"success", "token"=>"TEMPyp1N40NK8GM0Tx7A87E6Neak2tVJ"}
rpc.call('auth.token_remove', token)
can remove tokens stored in the database backend (Mdm).
@see #rpc_logout
@param [String] token The token to delete.
@return [Hash] A hash indicating the action was successful. It contains the following key:
* 'result' [String] The successful message: 'success'
@example Here's how you would use this from the client:
rpc.call('auth.token_remove', 'TEMPtcVmMld8w74zo0CYeosM3iXW0nJz')
This returns something like:
{"result"=>"success"}
console:
rpc.call('console.create')
Creates a new framework console instance.
@param [Hash] opts See Msf::Ui::Web::Driver#create_console
@return [Hash] Information about the new console. It contains the following keys:
* 'id' [Fixnum] The console's ID.
* 'prompt' [String] The framework prompt (example: 'msf > ')
* 'busy' [TrueClass] The console's busy state, or
* 'busy' [FalseClass] The console's busy state.
@example Here's how you would use this from the client:
rpc.call('console.create')
This returns something like:
{'busy': False, 'prompt': 'msf > ', 'id': '1'}
rpc.call('console.list')
Returns a list of framework consoles.
@return [Hash] Console information.
* 'consoles' [Array<Hash>] consoles, each element is a hash that includes:
* 'id' [Fixnum] The console's ID
* 'prompt' [String] The framework prompt (example: 'msf > ')
* 'busy' [TrueClass] The console's busy state, or
* 'busy' [FalseClass] The console's busy state.
@example Here's how you would use this from the client:
rpc.call('console.list')
This returns something like:
{'consoles': [{'busy': False, 'prompt': 'msf > ', 'id': '4'}]}
rpc.call('console.destroy', id)
Deletes a framework console instance.
@param [Fixnum] cid Framework console ID.
@return [Hash] A result indicating whether the action was successful or not.
It contains the following key:
* 'result' [String] Either 'success' or 'failure'.
@example Here's how you would use this from the client:
rpc.call('console.destroy', 1)
This returns something like:
{"result"=>"success"}
rpc.call('console.read', id)
Returns the framework console output in raw form.
@param [Fixnum] cid Framework console ID.
@return [Hash] There are two different hashes you might get:
If the console ID is invalid, you will get a hash like the following:
* 'result' [String] A value that says 'failure'.
If the console ID is valid, you will get a hash like the following:
* 'data' [String] The output the framework console produces (example: the banner)
* 'prompt' [String] The framework prompt (example: 'msf > ')
* 'busy' [TrueClass] The console's busy state, or
* 'busy' [FalseClass] The console's busy state.
@example Here's how you would use this from the client:
rpc.call('console.read', 1)
rpc.call('console.write', id, input)
Sends an input (such as a command) to the framework console.
@param [Fixnum] cid Framework console ID.
@param [String] data User input.
@return [Hash] There are two different hashes you might get:
If the console ID is invalid, you will get a hash like the following:
* 'result' [String] A value that says 'failure'.
If the console ID is invalid, you will get a hash like the following:
* 'wrote' [Fixnum] Number of bytes sent.
@note Remember to add a newline (\\r\\n) at the end of input, otherwise
the console will not do anything. And you will need to use the
rpc_read method to retrieve the output again.
@example Here's how you would use this from the client:
This will show the current module's options.
rpc.call('console.write', 4, "show options\r\n")
rpc.call('console.tabs', id, command)
Returns the tab-completed version of your input (such as a module path).
@param [Fixnum] cid Framework console ID.
@param [String] line Command.
@return [Hash] There are two different hashes you might get:
If the console ID is invalid, you will get a hash like the following:
* 'result' [String] A value that says 'failure'.
If the console ID is valid, you will get a hash like the following:
* 'tabs' [String] The tab-completed version of the command.
@example Here's how you would use this from the client:
This will return:
{"tabs"=>["use exploit/windows/smb/ms08_067_netapi"]}
rpc.call('console.tabs', 4, "use exploit/windows/smb/ms08_067_")
rpc.call('console.session_kill', id)
You might also want to considering using the session API calls instead of this.
@param [Fixnum] cid Framework console ID.
@return [Hash] A hash indicating whether the action was successful or not. It contains:
* 'result' [String] A message that says 'success' if the console ID is valid (and successfully killed, otherwise 'failed')
@example Here's how you would use this from the client:
rpc.call('console.session_kill', 4)
rpc.call('console.session_detach', id)
background an interactive session.
@param [Fixnum] cid Framework console ID.
@return [Hash] A hash indicating whether the action was successful or not. It contains:
* 'result' [String] A message that says 'success' if the console ID is valid (and successfully detached, otherwise 'failed')
@example Here's how you would use this from the client:
rpc.call('console.session_detach', 4)
core:
rpc.call('core.version')
Returns the RPC service versions.
@return [Hash] A hash that includes the version information:
* 'version' [String] Framework version
* 'ruby' [String] Ruby version
* 'api' [String] API version
@example Here's how you would use this from the client:
rpc.call('core.version')
rpc.call('core.stop')
Stops the RPC service.
@return [void]
@example Here's how you would use this from the client:
rpc.call('core.stop')
rpc.call('core.getg', GlobalSetting)
Returns a global datastore option.
@param [String] var The name of the global datastore.
@return [Hash] The global datastore option. If the option is not set, then the value is empty.
@example Here's how you would use this from the client:
rpc.call('core.getg', 'GlobalSetting')
rpc.call('core.setg', globalOpton, globalOptionValue)
Sets a global datastore option.
@param [String] var The hash key of the global datastore option.
@param [String] val The value of the global datastore option.
@return [Hash] A hash indicating the action was successful. It contains the following key:
* 'result' [String] The successful message: 'success'
@example Here's how you would use this from the client:
rpc.call('core.setg', 'MyGlobal', 'foobar')
rpc.call('core.unsetg', globalOption)
Unsets a global datastore option.
@param [String] var The global datastore option.
@return [Hash] A hash indicating the action was successful. It contains the following key:
* 'result' [String] The successful message: 'success'
@example Here's how you would use this from the client:
rpc.call('core.unsetg', 'MyGlobal')
rpc.call('core.save')
Saves current framework settings.
@return [Hash] A hash indicating the action was successful. It contains the following key:
* 'result' [String] The successful message: 'success'
@example Here's how you would use this from the client:
rpc.call('core.save')
rpc.call('core.reload_modules')
Reloads framework modules. This will take some time to complete.
@return [Hash] Module stats that contain the following keys:
* 'exploits' [Fixnum] The number of exploits reloaded.
* 'auxiliary' [Fixnum] The number of auxiliary modules reloaded.
* 'post' [Fixnum] The number of post modules reloaded.
* 'encoders' [Fixnum] The number of encoders reloaded.
* 'nops' [Fixnum] The number of NOP modules reloaded.
* 'payloads' [Fixnum] The number of payloads reloaded.
@example Here's how you would use this from the client:
rpc.call('core.reload_modules')
rpc.call('core.add_module_path', path)
this will not unload modules that were deleted from the file system that were previously loaded.
@param [String] path The new path to load.
@return [Hash] Module stats that contain the following keys:
* 'exploits' [Fixnum] The number of exploits loaded.
* 'auxiliary' [Fixnum] The number of auxiliary modules loaded.
* 'post' [Fixnum] The number of post modules loaded.
* 'encoders' [Fixnum] The number of encoders loaded.
* 'nops' [Fixnum] The number of NOP modules loaded.
* 'payloads' [Fixnum] The number of payloads loaded.
@example Here's how you would use this from the client:
rpc.call('core.add_module_path', '/tmp/modules/')
rpc.call('core.module_stats')
Returns the module stats.
@return [Hash] Module stats that contain the following keys:
* 'exploits' [Fixnum] The number of exploits.
* 'auxiliary' [Fixnum] The number of auxiliary modules.
* 'post' [Fixnum] The number of post modules.
* 'encoders' [Fixnum] The number of encoders.
* 'nops' [Fixnum] The number of NOP modules.
* 'payloads' [Fixnum] The number of payloads.
@example Here's how you would use this from the client:
rpc.call('core.module_stats')
rpc.call('core.thread_list')
Returns a list of framework threads.
@return [Hash] A collection of threads. Each key is the thread ID, and the value is another hash
that contains the following:
* 'status' [String] Thread status.
* 'critical' [Boolean] Thread is critical.
* 'name' [String] Thread name.
* 'started' [String] Timestamp of when the thread started.
@example Here's how you would use this from the cient:
You will get something like this:
{0=>{"status"=>"sleep", "critical"=>false, "name"=>"StreamServerListener", "started"=>"2015-04-21 15:25:49 -0500"}}
rpc.call('core.thread_list')
rpc.call('core.thread_kill', id)
Kills a framework thread.
@param [Fixnum] tid The thread ID to kill.
@return [Hash] A hash indicating the action was successful. It contains the following key:
* 'result' [String] A successful message: 'success'
@example Here's how you would use this from the client:
rpc.call('core.thread_kill', 10)
db:
rpc.call('db.create_cracked_credential', opts)
Creates a cracked credential.
@param [Hash] xopts Credential options. (See #create_credential Documentation)
@return [Metasploit::Credential::Core]
@see https://github.com/rapid7/metasploit-credential/blob/master/lib/metasploit/credential/creation.rb#L107 #create_credential Documentation.
@see #rpc_create_credential
@example Here's how you would use this from the client:
opts = {
username: username,
password: password,
core_id: core_id
}
rpc.call('db.create_cracked_credential', opts)
rpc.call('db.create_cracked_credential', opts)
Creates a credential.
@param [Hash] xopts Credential options. (See #create_credential Documentation)
@return [Hash] Credential data. It contains the following keys:
* 'username' [String] Username saved.
* 'private' [String] Password saved.
* 'private_type' [String] Password type.
* 'realm_value' [String] Realm.
* 'realm_key' [String] Realm key.
* 'host' [String] Host (Only avilable if there's a :last_attempted_at and :status)
* 'sname' [String] Service name (only available if there's a :last_attempted_at and :status)
* 'status' [Status] Login status (only available if there's a :last_attempted_at and :status)
@see https://github.com/rapid7/metasploit-credential/blob/master/lib/metasploit/credential/creation.rb#L107 #create_credential Documentation.
@example Here's how you would use this from the client:
opts = {
origin_type: :service,
address: '192.168.1.100',
port: 445,
service_name: 'smb',
protocol: 'tcp',
module_fullname: 'auxiliary/scanner/smb/smb_login',
workspace_id: myworkspace_id,
private_data: 'password1',
private_type: :password,
username: 'Administrator'
}
rpc.call('db.create_cracked_credential', opts)
rpc.call('db.invalidate_login', opts)
Sets the status of a login credential to a failure.
@param [Hash] xopts Credential data (See #invalidate_login Documentation)
@raise [Msf::RPC::Exception] If there's an option missing.
@return [void]
@see https://github.com/rapid7/metasploit-credential/blob/master/lib/metasploit/credential/creation.rb#L492 #invalidate_login Documentation
@see https://github.com/rapid7/metasploit-model/blob/master/lib/metasploit/model/login/status.rb Status symbols.
@example Here's how you would use this from the client:
opts = {
address: '192.168.1.100',
port: 445,
protocol: 'tcp',
public: 'admin',
private: 'password1',
status: 'Incorrect'
}
rpc.call('db.invalidate_login', opts)
rpc.call('db.creds', opts)
Returns login credentials from a specific workspace.
@param [Hash] xopts Options:
@option xopts [String] :workspace Name of the workspace.
@raise [Msf::RPC::ServerException] You might get one of these errors:
* 500 ActiveRecord::ConnectionNotEstablished. Try: rpc.call('console.create').
* 500 Database not loaded. Try: rpc.call('console.create')
* 500 Invalid workspace.
@return [Hash] Credentials with the following hash key:
* 'creds' [Array<Hash>] An array of credentials. Each hash in the array will have the following:
* 'user' [String] Username.
* 'pass' [String] Password.
* 'updated_at' [Fixnum] Last updated at.
* 'type' [String] Password type.
* 'host' [String] Host.
* 'port' [Fixnum] Port.
* 'proto' [String] Protocol.
* 'sname' [String] Service name.
@example Here's how you would use this from the client:
rpc.call('db.creds', {})
rpc.call('db.hosts', opts)
Returns information about hosts.
@param [Hash] xopts Options:
@option xopts [String] :workspace Name of the workspace.
@raise [Msf::RPC::ServerException] You might get one of these errors:
* 500 ActiveRecord::ConnectionNotEstablished. Try: rpc.call('console.create').
* 500 Database not loaded. Try: rpc.call('console.create')
* 500 Invalid workspace.
@return [Hash] Host information that starts with the following hash key:
* 'hosts' [Array<Hash>] An array of hosts. Each hash in the array will have the following:
* 'created_at' [Fixnum] Creation date.
* 'address' [String] IP address.
* 'mac' [String] MAC address.
* 'name' [String] Computer name.
* 'state' [String] Host's state.
* 'os_name' [String] Name of the operating system.
* 'os_flavor' [String] OS flavor.
* 'os_sp' [String] Service pack.
* 'os_lang' [String] OS language.
* 'updated_at' [Fixnum] Last updated at.
* 'purpose' [String] Host purpose (example: server)
* 'info' [String] Additional information about the host.
@example Here's how you would use this from the client:
rpc.call('db.hosts', {})
rpc.call('db.services', opts)
Returns information about services.
@param [Hash] xopts Options:
@option xopts [String] :workspace Name of workspace.
@option xopts [Fixnum] :limit Limit.
@option xopts [Fixnum] :offset Offset.
@option xopts [String] :proto Protocol.
@option xopts [String] :address Address.
@option xopts [String] :ports Port range.
@option xopts [String] :names Names (Use ',' as the separator).
@raise [Msf::RPC::ServerException] You might get one of these errors:
* 500 ActiveRecord::ConnectionNotEstablished. Try: rpc.call('console.create').
* 500 Database not loaded. Try: rpc.call('console.create')
* 500 Invalid workspace.
@return [Hash] A hash with the following keys:
* 'services' [Array<Hash>] In each hash of the array, you will get these keys:
* 'host' [String] Host.
* 'created_at' [Fixnum] Last created at.
* 'updated_at' [Fixnum] Last updated at.
* 'port' [Fixnum] Port.
* 'proto' [String] Protocol.
* 'state' [String] Service state.
* 'name' [String] Service name.
* 'info' [String] Additional information about the service.
@example Here's how you would use this from the client:
rpc.call('db.services', {})
rpc.call('db.vulns', opts)
Returns information about reported vulnerabilities.
@param [Hash] xopts Options:
@option xopts [String] :workspace Name of workspace.
@option xopts [Fixnum] :limit Limit.
@option xopts [Fixnum] :offset Offset.
@option xopts [String] :proto Protocol.
@option xopts [String] :address Address.
@option xopts [String] :ports Port range.
@raise [Msf::RPC::ServerException] You might get one of these errors:
* 500 ActiveRecord::ConnectionNotEstablished. Try: rpc.call('console.create').
* 500 Database not loaded. Try: rpc.call('console.create')
* 500 Invalid workspace.
@return [Hash] A hash with the following key:
* 'vulns' [Array<Hash>] In each hash of the array, you will get these keys:
* 'port' [Fixnum] Port.
* 'proto' [String] Protocol.
* 'time' [Fixnum] Time reported.
* 'host' [String] Vulnerable host.
* 'name' [String] Exploit that was used.
* 'refs' [String] Vulnerability references.
@example Here's how you would use this from the client:
rpc.call('db.vulns', {})
rpc.call('db.workspaces')
Returns information about workspaces.
@raise [Msf::RPC::Exception] Database not loaded.
@return [Hash] A hash with the following key:
* 'workspaces' [Array<Hash>] In each hash of the array, you will get these keys:
* 'id' [Fixnum] Workspace ID.
* 'name' [String] Workspace name.
* 'created_at' [Fixnum] Last created at.
* 'updated_at' [Fixnum] Last updated at.
@example Here's how you would use this from the client:
rpc.call('db.workspaces')
rpc.call('db.current_workspace')
Returns the current workspace.
@raise [Msf::RPC::Exception] Database not loaded. Try: rpc.call('console.create')
@return [Hash] A hash with the following keys:
* 'workspace' [String] Workspace name.
* 'workspace_id' [Fixnum] Workspace ID.
@example Here's how you would use this from the client:
rpc.call('db.current_workspace')
rpc.call('db.get_workspace')
Returns the current workspace.
@param [String] wspace workspace name.
@raise [Msf::RPC::Exception] You might get one of the following errors:
* 500 Database not loaded.
* 500 Invalid workspace.
@return [Hash] A hash with the following key:
* 'workspace' [Array<Hash>] In each hash of the array, you will get these keys:
* 'name' [String] Workspace name.
* 'id' [Fixnum] Workspace ID.
* 'created_at' [Fixnum] Last created at.
* 'updated_at' [Fixnum] Last updated at.
@example Here's how you would use this from the client:
rpc.call('db.get_workspace')
rpc.call('db.set_workspace', workspace)
Sets a workspace.
@param [String] wspace Workspace name.
@raise [Msf::RPC::ServerException] You might get one of these errors:
* 500 ActiveRecord::ConnectionNotEstablished. Try: rpc.call('console.create').
* 500 Database not loaded. Try: rpc.call('console.create')
* 500 Invalid workspace
* 404 Workspace not found.
@return [Hash] A hash indicating whether the action was successful or not. You will get:
* 'result' [String] A message that says either 'success' or 'failed'
@example Here's how you would use this from the client:
This will set the current workspace to 'default'
rpc.call('db.set_workspace', 'default')
rpc.call('db.wspace', workspace)
Deletes a workspace.
@param [String] wspace Workspace name.
@raise [Msf::RPC::ServerException] You might get one of these errors:
* 500 ActiveRecord::ConnectionNotEstablished. Try: rpc.call('console.create').
* 500 Database not loaded. Try: rpc.call('console.create')
* 404 Workspace not found.
@return [Hash] A hash indicating the action was successful. It contains the following:
* 'result' [String] A message that says 'success'.
@example Here's how you would use this from the client:
rpc.call('db.wspace', 'temp_workspace')
rpc.call('db.get_host', address)
Returns information about a host.
@param [Hash] xopts Options (:addr, :address, :host are the same thing, and you only need one):
@option xopts [String] :addr Host address.
@option xopts [String] :address Same as :addr.
@option xopts [String] :host Same as :address.
@raise [Msf::RPC::ServerException] You might get one of these errors:
* 500 ActiveRecord::ConnectionNotEstablished. Try: rpc.call('console.create').
* 500 Database not loaded. Try: rpc.call('console.create')
* 500 Invalid workspace.
@return [Hash] A hash that contains the following:
* 'host' [Array<Hash>] Each hash in the array contains the following:
* 'created_at' [Fixnum] Last created at.
* 'address' [String] Address.
* 'mac' [String] Mac address.
* 'name' [String] Host name.
* 'state' [String] Host state.
* 'os_name' [String] OS name.
* 'os_flavor' [String] OS flavor.
* 'os_sp' [String] OS service pack.
* 'os_lang' [String] OS language.
* 'updated_at' [Fixnum] Last updated at.
* 'purpose' [String] Purpose. Example: 'server'.
* 'info' [String] Additional information.
@example Here's how you would use this from the client:
rpc.call('db.get_host', {:host => ip})
rpc.call('db.report_host', hostInfo)
Reports a new host to the database.
@param [Hash] xopts Information to report about the host. See below:
@option xopts [String] :host IP address. You msut supply this.
@option xopts [String] :state One of the Msf::HostState constants. (See Most::HostState Documentation)
@option xopts [String] :os_name Something like "Windows", "Linux", or "Mac OS X".
@option xopts [String] :os_flavor Something like "Enterprise", "Pro", or "Home".
@option xopts [String] :os_sp Something like "SP2".
@option xopts [String] :os_lang Something like "English", "French", or "en-US".
@option xopts [String] :arch one of the ARCH_* constants. (see ARCH Documentation)
@option xopts [String] :mac Mac address.
@option xopts [String] :scope Interface identifier for link-local IPv6.
@option xopts [String] :virtual_host The name of the VM host software, eg "VMWare", "QEMU", "Xen", etc.
@see https://github.com/rapid7/metasploit-framework/blob/master/lib/msf/core/host_state.rb Most::HostState Documentation.
@see https://github.com/rapid7/metasploit-framework/blob/master/lib/rex/constants.rb#L66 ARCH Documentation.
@raise [Msf::RPC::ServerException] You might get one of these errors:
* 500 ActiveRecord::ConnectionNotEstablished. Try: rpc.call('console.create').
* 500 Database not loaded. Try: rpc.call('console.create')
* 500 Invalid workspace.
@return [Hash] A hash indicating whether the action was successful or not. It contains the following:
* 'result' [String] A message that says either 'success' or 'failed'.
@example Here's how you would use this from the client:
rpc.call('db.report_host', {:host => ip})
rpc.call('db.report_service', serviceInfo)
Reports a service to the database.
@param [Hash] xopts Information to report about the service. See below:
@option xopts [String] :host Required. The host where this service is running.
@option xopts [String] :port Required. The port where this service listens.
@option xopts [String] :proto Required. The transport layer protocol (e.g. tcp, udp).
@option xopts [String] :name The application layer protocol (e.g. ssh, mssql, smb).
@option xopts [String] :sname An alias for the above
@raise [Msf::RPC::ServerException] You might get one of these errors:
* 500 ActiveRecord::ConnectionNotEstablished. Try: rpc.call('console.create').
* 500 Database not loaded. Try: rpc.call('console.create')
* 500 Invalid workspace.
@return [Hash] A hash indicating whether the action was successful or not. It contains:
* 'result' [String] A message that says either 'success' or 'failed'.
@example Here's how you would use this from the client:
rpc.call('db.report_service', {:host=>ip, :port=>8181, :proto=>'tcp', :name=>'http'})
rpc.call('db.get_service', search)
Returns information about a service.
@param [Hash] xopts Filters for the search, see below:
@option xopts [String] :workspace Workspace name.
@option xopts [String] :proto Protocol.
@option xopts [Fixnum] :port Port.
@option xopts [String] :names Service names.
@raise [Msf::RPC::ServerException] You might get one of these errors:
* 500 ActiveRecord::ConnectionNotEstablished. Try: rpc.call('console.create').
* 500 Database not loaded. Try: rpc.call('console.create')
* 500 Invalid workspace.
@return [Hash] A hash that contains the following key:
* 'service' [Array<Hash>] Each hash in the array contains the following:
* 'host' [String] Host address.
* 'created_at' [Fixnum] Creation date.
* 'port' [Fixnum] Port.
* 'proto' [String] Protocol.
* 'state' [String] Service state.
* 'name' [String] Service name.
* 'info' [String] Additional information.
@example Here's how you would use this from the client:
rpc.call('db.get_service', {:workspace=>'default', :proto=>'tcp', :port=>443})
rpc.call('db.get_note', opts)
Returns a note.
@param [Hash] xopts Options.
@option xopts [String] :addr Host address.
@option xopts [String] :address Same as :addr.
@option xopts [String] :host Same as :address.
@option xopts [String] :proto Protocol.
@option xopts [Fixnum] :port Port.
@option xopts [String] :ntype Note type.
@raise [Msf::RPC::ServerException] You might get one of these errors:
* 500 ActiveRecord::ConnectionNotEstablished. Try: rpc.call('console.create').
* 500 Database not loaded. Try: rpc.call('console.create')
* 500 Invalid workspace.
@return [Hash] A hash that contains the following:
* 'note' [Array<Hash>] Each hash in the array contains the following:
* 'host' [String] Host.
* 'port' [Fixnum] Port.
* 'proto' [String] Protocol.
* 'created_at' [Fixnum] Last created at.
* 'updated_at' [Fixnum] Last updated at.
* 'ntype' [String] Note type.
* 'data' [String] Note data.
* 'critical' [String] A boolean indicating criticality.
* 'seen' [String] A boolean indicating whether the note has been seen before.
@example Here's how you would use this from the client:
rpc.call('db.get_note', {:proto => 'tcp', :port => 80})
rpc.call('db.get_client', opts)
Returns information about a client connection.
@param [Hash] xopts Options:
@option xopts [String] :workspace Workspace name.
@option xopts [String] :ua_string User agent string.
@option xopts [String] :host Host IP.
@raise [Msf::RPC::ServerException] You might get one of these errors:
* 500 ActiveRecord::ConnectionNotEstablished. Try: rpc.call('console.create').
* 500 Database not loaded. Try: rpc.call('console.create')
* 500 Invalid workspace.
@return [Hash] A hash that contains the client connection:
* 'client' [Array<Hash>] Each hash of the array contains the following:
* 'host' [String] Host IP.
* 'created_at' [Fixnum] Created date.
* 'updated_at' [Fixnum] Last updated at.
* 'ua_string' [String] User-Agent string.
* 'ua_name' [String] User-Agent name.
* 'ua_ver' [String] User-Agent version.
@example Here's how you would use this from the client:
rpc.call('db.get_client', {:workspace=>'default', :ua_string=>user_agent, :host=>ip})
rpc.call('db.report_client', clientInfo)
Reports a client connection.
@param [Hash] xopts Information about the client.
@option xopts [String] :ua_string Required. User-Agent string.
@option xopts [String] :host Required. Host IP.
@option xopts [String] :ua_name One of the Msf::HttpClients constants. (See Msf::HttpClient Documentation.)
@option xopts [String] :ua_ver Detected version of the given client.
@option xopts [String] :campaign An id or Campaign object.
@see https://github.com/rapid7/metasploit-framework/blob/master/lib/msf/core/constants.rb#L52 Msf::HttpClient Documentation.
@raise [Msf::RPC::ServerException] You might get one of these errors:
* 500 ActiveRecord::ConnectionNotEstablished. Try: rpc.call('console.create').
* 500 Database not loaded. Try: rpc.call('console.create')
* 500 Invalid workspace.
@return [Hash] A hash indicating whether the action was successful or not. It contains:
* 'result' [String] A message that says either 'success' or 'failed'.
@example Here's how you would use this from the client:
rpc.call('db.report_client', {:workspace=>'default', :ua_string=>user_agent, :host=>ip})
rpc.call('db.report_note', noteInfo)
Reports a note.
@param [Hash] xopts Information about the note.
@option xopts [String] :type Required. The type of note, e.g. smb_peer_os.
@option xopts [String] :workspace The workspace to associate with this note.
@option xopts [String] :host An IP address or a Host object to associate with this note.
@option xopts [String] :service A Service object to associate with this note.
@option xopts [String] :data Whatever it is you're making a note of.
@option xopts [Fixnum] :port Along with +:host+ and +:proto+, a service to associate with this note.
@option xopts [String] :proto Along with +:host+ and +:port+, a service to associate with this note.
@option xopts [Hash] A hash that contains the following information.
* :unique [Boolean] Allow only a single Note per +:host+/+:type+ pair.
* :unique_data [Boolean] Like +:uniqe+, but also compare +:data+.
* :insert [Boolean] Always insert a new Note even if one with identical values exists.
@raise [Msf::RPC::ServerException] You might get one of these errors:
* 500 ActiveRecord::ConnectionNotEstablished. Try: rpc.call('console.create').
* 500 Database not loaded. Try: rpc.call('console.create')
* 500 Invalid workspace.
@return [Hash] A hash indicating whether the action was successful or not. It contains:
* 'result' [String] A message that says either 'success' or 'failed'.
@example Here's how you would use this from the client:
rpc.call('db.report_note', {:type=>'http_data', :host=>'192.168.1.123', :data=>'data'})
rpc.call('db.notes', search)
Returns notes from the database.
@param [Hash] xopts Filters for the search. See below:
@option xopts [String] :address Host address.
@option xopts [String] :names Names (separated by ',').
@option xopts [String] :ntype Note type.
@option xopts [String] :proto Protocol.
@option xopts [String] :ports Port change.
@raise [Msf::RPC::ServerException] You might get one of these errors:
* 500 ActiveRecord::ConnectionNotEstablished. Try: rpc.call('console.create').
* 500 Database not loaded. Try: rpc.call('console.create')
* 500 Invalid workspace.
@return [Hash] A hash that contains the following:
* 'notes' [Array<Hash>] Each hash in the array contains the following:
* 'time' [Fixnum] Creation date.
* 'host' [String] Host address.
* 'service' [String] Service name or port.
* 'type' [String] Host type.
* 'data' [String] Host data.
@example Here's how you would use this from the client:
This gives you all the notes.
rpc.call('db.notes', {})
rpc.call('db.get_ref', refName)
Returns an external vulnerability reference.
@param [String] name Reference name.
@raise [Msf::RPC::ServerException] You might get one of these errors:
* 500 ActiveRecord::ConnectionNotEstablished. Try: rpc.call('console.create').
* 500 Database not loaded. Try: rpc.call('console.create')
* 500 Invalid workspace.
@return [String] Reference.
@example Here's how you would use this from the client:
rpc.call('db.get_ref', ref_name)
rpc.call('db.del_vuln', opts)
Deletes vulnerabilities.
@param [Hash] xopts Filters that narrow down which vulnerabilities to delete. See below:
@option xopts [String] :workspace Workspace name.
@option xopts [String] :host Host address.
@option xopts [String] :address Same as :host.
@option xopts [Array] :addresses Same as :address.
@option xopts [Fixnum] :port Port.
@option xopts [String] :proto Protocol.
@option xopts [String] :name Name of the vulnerability.
@raise [Msf::RPC::ServerException] You might get one of these errors:
* 500 ActiveRecord::ConnectionNotEstablished. Try: rpc.call('console.create').
* 500 Database not loaded. Try: rpc.call('console.create')
* 500 Invalid workspace.
@return [Hash] A hash that contains the following:
* 'result' [String] A message that says 'success'.
* 'deleted' [Array<Hash>] Each hash in the array contains the following:
* 'address' [String] Host address.
* 'port' [Fixnum] Port.
* 'proto' [String] Protocol.
* 'name' [String] Vulnerability name.
@example Here's how you would use this from the client:
rpc.call('db.del_vuln', {:host=>ip, :port=>445, :proto=>'tcp'})
rpc.call('db.del_note', opts)
Deletes notes.
@param [Hash] xopts Filters to narrow down which notes to delete.
@option xopts [String] :workspace Workspace name.
@option xopts [String] :host Host address.
@option xopts [String] :address Same as :host.
@option xopts [Array] :addresses Same as :address.
@option xopts [Fixnum] :port Port.
@option xopts [String] :proto Protocol.
@option xopts [String] :ntype Note type.
@raise [Msf::RPC::ServerException] You might get one of these errors:
* 500 ActiveRecord::ConnectionNotEstablished. Try: rpc.call('console.create').
* 500 Database not loaded. Try: rpc.call('console.create')
* 500 Invalid workspace.
@return [Hash] A hash that contains the following:
* 'result' [String] A message that says 'success'.
* 'deleted' [Array<Hash>] Each hash in the array contains the following:
* 'address' [String] Host address.
* 'port' [Fixnum] Port.
* 'proto' [String] Protocol.
* 'ntype' [String] Note type.
@example Here's how you would use this from the client:
rpc.call('db.del_note', {:workspace=>'default', :host=>ip, :port=>443, :proto=>'tcp'})
rpc.call('db.del_service', opts)
Deletes services.
@param [Hash] xopts Filters to narrow down which services to delete.
@option xopts [String] :workspace Workspace name.
@option xopts [String] :host Host address.
@option xopts [String] :address Same as :host.
@option xopts [Array] :addresses Host addresses.
@option xopts [Fixnum] :port Port.
@option xopts [String] :proto Protocol.
@raise [Msf::RPC::ServerException] You might get one of these errors:
* 500 ActiveRecord::ConnectionNotEstablished. Try: rpc.call('console.create').
* 500 Database not loaded. Try: rpc.call('console.create')
* 500 Invalid workspace.
@return [Hash] A hash that contains the following:
* 'result' [String] A message that says 'success' or 'failed'.
* 'deleted' [Array<Hash>] If result says success, then you will get this key.
Each hash in the array contains:
* 'address' [String] Host address.
* 'port' [Fixnum] Port.
* 'proto' [String] Protocol.
@example Here's how you would use this from the client:
rpc.call('db.del_service', {:host=>ip})
rpc.call('db.del_host', opts)
Deletes hosts.
@param [Hash] xopts Filters to narrow down which hosts to delete.
@option xopts [String] :workspace Workspace name.
@option xopts [String] :host Host address.
@option xopts [String] :address Same as :host.
@option xopts [Array] :addresses Host addresses.
@raise [Msf::RPC::ServerException] You might get one of these errors:
* 500 ActiveRecord::ConnectionNotEstablished. Try: rpc.call('console.create').
* 500 Database not loaded. Try: rpc.call('console.create')
* 500 Invalid workspace.
@return [Hash] A hash that contains the following:
* 'result' [String] A message that says 'success'.
* 'deleted' [Array<String>] All the deleted hosts.
@example Here's how you would use this from the client:
rpc.call('db.del_host', {:host=>ip})
rpc.call('db.report_vuln', vulInfo)
Reports a vulnerability.
@param [Hash] xopts Information about the vulnerability:
@option xopts [String] :workspace Workspace name.
@option xopts [String] :host The host where this vulnerability resides
@option xopts [String] :name The friendly name for this vulnerability (title).
@option xopts [String] :info A human readable description of the vuln, free-form text.
@option xopts [Array] :refs An array of Ref objects or string names of references.
@option xopts [Hash] :details A hash with :key pointed to a find criteria hash and the rest containing VulnDetail fields.
@raise [Msf::RPC::ServerException] You might get one of these errors:
* 500 ActiveRecord::ConnectionNotEstablished. Try: rpc.call('console.create').
* 500 Database not loaded. Try: rpc.call('console.create')
* 500 Invalid workspace.
@return [Hash] A hash indicating whether the action was successful or not. It contains:
* 'result' [String] A message that says either 'success' or 'failed'.
@example Here's how you would use this from the client:
rpc.call('db.report_vuln', {:host=>ip, :name=>'file upload'})
rpc.call('db.events', opts)
Returns framework events.
@param [Hash] xopts Options:
@option xopts [String] :workspace Workspace name.
@option xopts [Fixnum] :limit Limit.
@option xopts [Fixnum] :offset Offset.
@raise [Msf::RPC::ServerException] You might get one of these errors:
* 500 ActiveRecord::ConnectionNotEstablished. Try: rpc.call('console.create').
* 500 Database not loaded. Try: rpc.call('console.create')
* 500 Invalid workspace.
@return [Hash] A hash that contains the following:
* 'events' [Array<Hash>] Each hash in the array contains the following:
* 'host' [String] Host address.
* 'created_at' [Fixnum] Creation date.
* 'updated_at' [Fixnum] Last updated at.
* 'name' [String] Event name.
* 'critical' [Boolean] Criticality.
* 'username' [String] Username.
* 'info' [String] Additional information.
@example Here's how you would use this from the client:
rpc.call('db.events', {})
rpc.call('db.report_event', eventInfo)
Reports a framework event.
@param [Hash] xopts Information about the event.
@option xopts [String] :workspace Workspace name.
@option xopts [String] :username Username.
@option xopts [String] :host Host address.
@raise [Msf::RPC::ServerException] You might get one of these errors:
* 500 ActiveRecord::ConnectionNotEstablished. Try: rpc.call('console.create').
* 500 Database not loaded. Try: rpc.call('console.create')
* 500 Invalid workspace.
@return [Hash] A hash indicating the action was successful. It contains:
* 'result' [String] A message that says 'success'.
@example Here's how you would use this from the client:
rpc.call('db.report_event', {:username => username, :host=>ip})
rpc.call('db.report_loot', itemInfo)
Reports a looted item.
@param [Hash] xopts Information about the looted item.
@option xopts [String] :workspace Workspace name.
@option xopts [String] :host Host address.
@option xopts [Fixnum] :port Port. Should match :service.
@option xopts [String] :proto Protocol. Should match :service.
@option xopts [String] :path Required. Path where the item was looted.
@option xopts [String] :type Loot type.
@option xopts [String] :ctype Content type.
@option xopts [String] :name Name.
@option xopts [String] :info Additional information.
@option xopts [String] :data Looted data.
@option xopts [Mdm::Service] :service Service where the data was found.
@raise [Msf::RPC::ServerException] You might get one of these errors:
* 500 ActiveRecord::ConnectionNotEstablished. Try: rpc.call('console.create').
* 500 Database not loaded. Try: rpc.call('console.create')
* 500 Invalid workspace.
@return [Hash] A hash that contains the following:
* 'result' [String] A message that says 'success'.
@example Here's how you would use this from the client:
rpc.call('db.report_loot', {})