MCPcopy Index your code
hub / github.com/secdev/scapy / connect

Method connect

scapy/modules/ldaphero.py:179–277  ·  view source on GitHub ↗

Connect command.

(self)

Source from the content-addressed store, hash-verified

177 self.main()
178
179 def connect(self):
180 """
181 Connect command.
182 """
183 # If host is None, we need to ask for it via a dialog.
184 if self.host is None:
185 # Get dialog
186 popup = BasePopup(self.root)
187 dlg = popup.dlg
188
189 # Connect UI
190 serverv = tk.StringVar()
191 serverv.set(self.host or "")
192 ttk.Label(dlg, text="Server").grid(row=0, column=0)
193 serverf = tk.Entry(dlg, textvariable=serverv)
194 serverf.grid(row=0, column=1)
195
196 portv = tk.StringVar()
197 portv.set("389")
198 ttk.Label(dlg, text="Port").grid(row=1, column=0)
199 tk.Entry(dlg, textvariable=portv).grid(row=1, column=1)
200
201 sslv = tk.BooleanVar()
202 ttk.Label(dlg, text="SSL").grid(row=2, column=0)
203 ttk.Checkbutton(dlg, variable=sslv).grid(row=2, column=1)
204
205 ttk.Button(dlg, text="OK", command=popup.dismiss).grid(row=3, column=0)
206 ttk.Button(dlg, text="Cancel", command=popup.cancel).grid(row=3, column=1)
207
208 serverf.focus()
209
210 # Setup
211 if popup.run():
212 # Cancelled
213 return
214
215 # Get values
216 self.host = serverv.get()
217 try:
218 self.port = int(portv.get())
219 except ValueError:
220 return
221 self.ssl = sslv.get()
222
223 # Connect now !
224 self.tprint(
225 "client.connect(host='%s', port=%s, ssl=%s)"
226 % (self.host, self.port, self.ssl)
227 )
228 try:
229 self.client.connect(self.host, port=self.port, use_ssl=self.ssl)
230 except Exception as ex:
231 self.tprint(str(ex))
232 raise
233 self.tprint("Established connection to %s." % self.host)
234 self.connected = True
235
236 # Alright, change the UI.

Callers 1

p0f_getlocalsigsFunction · 0.45

Calls 8

runMethod · 0.95
tprintMethod · 0.95
_showsearchresultMethod · 0.95
bindMethod · 0.95
BasePopupClass · 0.85
setMethod · 0.45
getMethod · 0.45
searchMethod · 0.45

Tested by

no test coverage detected