How to use set_module method in autotest

Best Python code snippet using autotest_python

test_completer.py

Source:test_completer.py Github

copy

Full Screen

...17 self.isf.terminate(force=True)18 def assertPrompt(self, *args):19 value = ''.join(args)20 self.isf.expect_exact(value, timeout=1)21 def set_module(self):22 self.isf.send("use creds/ftp_bruteforce\r\n")23 self.assertPrompt(self.module_prompt('FTP Bruteforce'))24 def test_raw_commands_no_module(self):25 self.isf.send("\t\t")26 self.assertPrompt('exec exit help search show use \r\n', self.raw_prompt)27 def test_complete_use_raw(self):28 self.isf.send("u\t\t")29 self.assertPrompt(self.raw_prompt, 'use ')30 def test_complete_use(self):31 self.isf.send("use \t\t")32 self.assertPrompt(33 'creds exploits scanners \r\n',34 self.raw_prompt,35 'use '36 )37 def test_complete_use_creds(self):38 self.isf.send("use cr\t\t")39 self.assertPrompt(40 self.raw_prompt,41 'use creds/'42 )43 def test_complete_use_creds_2(self):44 self.isf.send("use creds/\t\t")45 self.assertPrompt(46 'creds/http_basic_default'47 )48 def test_complete_use_exploits(self):49 self.isf.send("use ex\t\t")50 print(self.raw_prompt)51 self.assertPrompt(52 self.raw_prompt,53 'use exploits/'54 )55 def test_complete_use_exploits_2(self):56 self.isf.send("use exploits/plcs/sie\t")57 self.assertPrompt(58 self.raw_prompt,59 'use exploits/plcs/siemens/'60 )61 def test_raw_commands_with_module(self):62 self.set_module()63 self.isf.send("\t\t")64 self.assertPrompt(65 'back exec help search setg use \r\n'66 'check exit run set show \r\n',67 self.module_prompt('FTP Bruteforce')68 )69 def test_complete_back_raw(self):70 self.set_module()71 self.isf.send("b\t\t")72 self.assertPrompt(73 self.module_prompt('FTP Bruteforce'),74 'back'75 )76 def test_complete_check_raw(self):77 self.set_module()78 self.isf.send("c\t\t")79 self.assertPrompt(80 self.module_prompt('FTP Bruteforce'),81 'check'82 )83 def test_complete_run_raw(self):84 self.set_module()85 self.isf.send("r\t\t")86 self.assertPrompt(87 self.module_prompt('FTP Bruteforce'),88 'run'89 )90 def test_complete_search(self):91 self.set_module()92 self.isf.send("sea\t")93 self.assertPrompt(94 self.module_prompt('FTP Bruteforce'),95 'search ',96 )97 def test_complete_set_raw(self):98 self.set_module()99 self.isf.send("s\t\t")100 self.assertPrompt(101 'search set setg show \r\n',102 self.module_prompt('FTP Bruteforce')103 )104 def test_complete_set_raw_2(self):105 self.set_module()106 self.isf.send("se\t\t")107 self.assertPrompt(108 'search set setg \r\n',109 self.module_prompt('FTP Bruteforce'),110 )111 def test_complete_set_raw_3(self):112 self.set_module()113 self.isf.send("set\t\t")114 self.assertPrompt(115 'set setg \r\n',116 self.module_prompt('FTP Bruteforce'),117 )118 def test_complete_set(self):119 self.set_module()120 self.isf.send("set \t\t")121 self.assertPrompt(122 'passwords stop_on_success threads verbosity\r\n'123 'port target usernames \r\n',124 self.module_prompt('FTP Bruteforce'),125 'set ',126 )127 def test_complete_set_2(self):128 self.set_module()129 self.isf.send("set u\t\t")130 self.assertPrompt(131 self.module_prompt('FTP Bruteforce'),132 'set usernames ',133 )134 def test_complete_setg(self):135 self.set_module()136 self.isf.send("setg \t\t")137 self.assertPrompt(138 'passwords stop_on_success threads verbosity\r\n'139 'port target usernames \r\n',140 self.module_prompt('FTP Bruteforce'),141 'setg ',142 )143 def test_complete_setg_2(self):144 self.set_module()145 self.isf.send("setg u\t\t")146 self.assertPrompt(147 self.module_prompt('FTP Bruteforce'),148 'setg usernames ',149 )150 def test_complete_unsetg(self):151 """152 Not present in completion if no global option is set153 """154 self.set_module()155 self.isf.send("\t\t")156 self.assertPrompt(157 "back exec help search setg use \r\n"158 "check exit run set show \r\n",159 self.module_prompt('FTP Bruteforce'),160 )161 def test_complete_unsetg_2(self):162 """163 Available only when global options is set164 """165 self.set_module()166 self.isf.send("setg target foo\r\n")167 self.isf.send("\t\t")168 self.assertPrompt(169 'back exec help search setg unsetg \r\n'170 'check exit run set show use \r\n',171 self.module_prompt('FTP Bruteforce'),172 )173 def test_complete_unsetg_3(self):174 """175 Testing presence of available options176 """177 self.set_module()178 self.isf.send("setg target foo\r\n")179 self.isf.send("setg port bar\r\n")180 self.isf.send("unsetg \t\t")181 self.assertPrompt(182 "port target \r\n",183 self.module_prompt('FTP Bruteforce'),184 )185 def test_complete_unsetg_4(self):186 """187 Testing presence of available options188 """189 self.set_module()190 self.isf.send("setg target foo\r\n")191 self.isf.send("unsetg t\t\t")192 self.assertPrompt(193 self.module_prompt('FTP Bruteforce'),194 "unsetg target"195 )196 def test_complete_show_raw(self):197 self.set_module()198 self.isf.send("sh\t\t")199 self.assertPrompt(200 self.module_prompt('FTP Bruteforce'),201 'show ',202 )203 def test_complete_show(self):204 self.set_module()205 self.isf.send("show \t\t")206 self.assertPrompt(207 'all creds devices exploits info options scanners\r\n',208 self.module_prompt('FTP Bruteforce')209 )210 def test_complete_show_info(self):211 self.set_module()212 self.isf.send("show i\t\t")213 self.assertPrompt(214 self.module_prompt('FTP Bruteforce'),215 'show info'216 )217 def test_complete_show_options(self):218 self.set_module()219 self.isf.send("show o\t\t")220 self.assertPrompt(221 self.module_prompt('FTP Bruteforce'),222 'show options'223 )224if __name__ == '__main__':...

Full Screen

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run autotest automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful