rsmusllp / king-phisher

Phishing Campaign Toolkit
BSD 3-Clause "New" or "Revised" License
2.23k stars 538 forks source link

Can't send email #163

Closed b3nny0 closed 7 years ago

b3nny0 commented 7 years ago

Issue Description

When sending a message, I get the following: Checking the target URL... success, done Skipped checking the SPF policy because the SMTP server address could not be detected. Message mode is: Email

Then the screen just stalls. Messages never send. I am using gmail with the settings listed in the Wiki SMTP Server - smtp.gmail.com:465 SMTP Username - my gmail account Send Rate limit - 50 connect with SSL - on Tunnel over SSH - off

Reproduction Steps

  1. Start King Phisher
  2. create a campaign, attach a CSV file with users, go to send, hit start, and message above appears

    Environment Details

Host OS: Ubuntu 14.04 LTS

Error Details / Stack Trace

Not sure how to run a stack trace.

wolfthefallen commented 7 years ago

What is your current version of King Phisher ./KingPhisher --version. Please verify your setting are correct for sending emails through gmail.

b3nny0 commented 7 years ago

Current version is 1.5.0-beta gmail settings are correct

I got the version from help | about because running the command gives me the following error:

root@king-phisher:/opt/king-phisher# ./KingPhisher --version Traceback (most recent call last): File "./KingPhisher", line 44, in from king_phisher import color File "/opt/king-phisher/king_phisher/init.py", line 33, in from . import version File "/opt/king-phisher/king_phisher/version.py", line 37, in import smoke_zephyr.utilities ImportError: No module named smoke_zephyr.utilities

wolfthefallen commented 7 years ago

I've been unable to reproduce the issue. Have you tried sending to a single target?

b3nny0 commented 7 years ago

I have, and receive the same thing. Tired a couple different gmail accounts too. Do you think it could be content? I am using the Anti-Virus_Update email template (with a couple wording things added in) and the scan.html template from the Anti-Virus_Update website templates.

Do you think i should re-install?

wolfthefallen commented 7 years ago

please restart your KingPhisher client in debug mode and go through the process of sending out the email and send me output. From your King Phisher directory python3 KingPhisher -L DEBUG

b3nny0 commented 7 years ago

root@king-phisher:/opt/king-phisher# python3 KingPhisher -L DEBUG WARNING it is not necessary to run the king phisher client as root DEBUG king phisher version: 1.5.0-beta python version: 3.4.3 DEBUG client running in process: 4028 main tid: 0x7f9c111aa740 DEBUG using ui data from glade file: /opt/king-phisher/data/client/king_phisher/king-phisher-client.ui DEBUG gi.repository GLib version: 2.40.0 DEBUG gi.repository GObject version: 3.12.0 DEBUG gi.repository Gtk version: 3.10.8 DEBUG gi.repository VTE version: 2.90 DEBUG matplotlib version: 1.5.1 INFO loading the config from disk INFO loading 2 plugins DEBUG plugin 'check_for_updates' has been loaded DEBUG plugin 'data_collection' has been loaded DEBUG client loaded in 0.02 seconds

(KingPhisher:4028): Gtk-WARNING **: Failed to register client: GDBus.Error:org.freedesktop.DBus.Error.ServiceUnknown: The name org.gnome.SessionManager was not provided by any .service files DEBUG resetting the gtk-theme-name property to it's default value DEBUG resetting the gtk-icon-theme-name property to it's default value DEBUG loading style from css file: /opt/king-phisher/data/client/king_phisher/style/theme.v1.css DEBUG loading GTK builder object with id: MainMenuBar.menuitem_file_open DEBUG loading GTK builder object with id: MainMenuBar.menuitem_file_quit DEBUG loading GTK builder object with id: MainMenuBar.menuitem_tools_rpc_terminal DEBUG loading GTK builder object with id: MainMenuBar.menuitem_tools_sftp_client DEBUG loading GTK builder object with id: MainMenuBar.menuitem_tools_create_graph DEBUG loading GTK builder object with id: MailSenderConfigurationTab.button_target_file_select DEBUG loading GTK builder object with id: MailSenderConfigurationTab.calendar_calendar_invite_date DEBUG loading GTK builder object with id: MailSenderConfigurationTab.checkbutton_calendar_invite_all_day DEBUG loading GTK builder object with id: MailSenderConfigurationTab.checkbutton_calendar_request_rsvp DEBUG loading GTK builder object with id: MailSenderConfigurationTab.combobox_importance DEBUG loading GTK builder object with id: MailSenderConfigurationTab.combobox_sensitivity DEBUG loading GTK builder object with id: MailSenderConfigurationTab.entry_webserver_url DEBUG loading GTK builder object with id: MailSenderConfigurationTab.entry_calendar_invite_location DEBUG loading GTK builder object with id: MailSenderConfigurationTab.entry_calendar_invite_summary DEBUG loading GTK builder object with id: MailSenderConfigurationTab.entry_company_name DEBUG loading GTK builder object with id: MailSenderConfigurationTab.entry_source_email DEBUG loading GTK builder object with id: MailSenderConfigurationTab.entry_source_email_smtp DEBUG loading GTK builder object with id: MailSenderConfigurationTab.entry_source_email_alias DEBUG loading GTK builder object with id: MailSenderConfigurationTab.entry_subject DEBUG loading GTK builder object with id: MailSenderConfigurationTab.entry_reply_to_email DEBUG loading GTK builder object with id: MailSenderConfigurationTab.entry_html_file DEBUG loading GTK builder object with id: MailSenderConfigurationTab.entry_target_file DEBUG loading GTK builder object with id: MailSenderConfigurationTab.entry_target_name DEBUG loading GTK builder object with id: MailSenderConfigurationTab.entry_target_email_address DEBUG loading GTK builder object with id: MailSenderConfigurationTab.entry_attachment_file DEBUG loading GTK builder object with id: MailSenderConfigurationTab.expander_calendar_invite_settings DEBUG loading GTK builder object with id: MailSenderConfigurationTab.expander_email_settings DEBUG loading GTK builder object with id: MailSenderConfigurationTab.radiobutton_message_type_calendar_invite DEBUG loading GTK builder object with id: MailSenderConfigurationTab.radiobutton_message_type_email DEBUG loading GTK builder object with id: MailSenderConfigurationTab.radiobutton_target_type_file DEBUG loading GTK builder object with id: MailSenderConfigurationTab.radiobutton_target_type_single DEBUG loading GTK builder object with id: MailSenderConfigurationTab.spinbutton_calendar_invite_duration DEBUG loading GTK builder object with id: MailSenderConfigurationTab.spinbutton_calendar_invite_start_hour DEBUG loading GTK builder object with id: MailSenderConfigurationTab.spinbutton_calendar_invite_start_minute DEBUG loading GTK builder object with id: MailSenderConfigurationTab.viewport DEBUG loading GTK builder object with id: MailSenderEditTab.toolbutton_save_as_html_file DEBUG loading GTK builder object with id: MailSenderEditTab.toolbutton_save_html_file DEBUG loading GTK builder object with id: MailSenderEditTab.view_html_file DEBUG loading HTML completion data from: /opt/king-phisher/data/client/king_phisher/completion/html.json DEBUG loading Jinja completion data from: /opt/king-phisher/data/client/king_phisher/completion/jinja.json DEBUG loading GTK builder object with id: MailSenderSendTab.button_mail_sender_start DEBUG loading GTK builder object with id: MailSenderSendTab.button_mail_sender_stop DEBUG loading GTK builder object with id: MailSenderSendTab.textview_mail_sender_progress DEBUG loading GTK builder object with id: MailSenderSendTab.togglebutton_mail_sender_pause DEBUG loading GTK builder object with id: MailSenderSendTab.progressbar_mail_sender DEBUG loading GTK builder object with id: MailSenderSendTab.scrolledwindow_mail_sender_progress INFO matplotlib is installed, dashboard will be available DEBUG loading GTK builder object with id: CampaignViewDashboardTab.box_top_left DEBUG loading GTK builder object with id: CampaignViewDashboardTab.box_top_right DEBUG loading GTK builder object with id: CampaignViewDashboardTab.box_bottom DEBUG loading GTK builder object with id: CampaignViewDashboardTab.scrolledwindow_top_left DEBUG loading GTK builder object with id: CampaignViewDashboardTab.scrolledwindow_top_right DEBUG loading GTK builder object with id: CampaignViewDashboardTab.scrolledwindow_bottom DEBUG dashboard refresh frequency set to 300 seconds DEBUG loading GTK builder object with id: CampaignViewMessagesTab.button_refresh DEBUG loading GTK builder object with id: CampaignViewMessagesTab.treeview_campaign DEBUG loading GTK builder object with id: CampaignViewVisitsTab.button_refresh DEBUG loading GTK builder object with id: CampaignViewVisitsTab.treeview_campaign DEBUG loading GTK builder object with id: CampaignViewCredentialsTab.button_refresh DEBUG loading GTK builder object with id: CampaignViewCredentialsTab.treeview_campaign DEBUG loading GTK builder object with id: LoginDialog.button_connect DEBUG loading GTK builder object with id: LoginDialog.entry_server DEBUG loading GTK builder object with id: LoginDialog.entry_server_username DEBUG loading GTK builder object with id: LoginDialog.entry_server_password DEBUG loading GTK builder object with id: LoginDialog.entry_server_one_time_password DEBUG loading GTK builder object with id: LoginDialog.label_main DEBUG loading GTK builder object with id: LoginDialog.label_server_one_time_password DEBUG loading GTK builder object with id: LoginDialog.revealer_server_one_time_password DEBUG loading GTK builder object with id: LoginDialog.spinbutton_server_remote_port DEBUG loading GTK builder object with id: LoginDialog.switch_server_use_ssl INFO connecting to local king phisher instance DEBUG using serializer: application/json DEBUG using serializer: binary/message-pack DEBUG calling RPC method: version INFO successfully connected to the king phisher server (version: 1.5.0-beta rpc api version: 5.1) DEBUG calling RPC method: login DEBUG successfully authenticated to the remote king phisher service DEBUG calling RPC method: config/get DEBUG calling RPC method: db/table/get INFO campaign set to Concordia AV Phishing Test (id: 2) INFO the RPC cache has been purged DEBUG calling RPC method: db/table/get DEBUG calling RPC method: db/table/get DEBUG calling RPC method: db/table/get DEBUG calling RPC method: db/table/view DEBUG calling RPC method: db/table/view DEBUG calling RPC method: db/table/view DEBUG calling RPC method: db/table/view DEBUG calling RPC method: db/table/get DEBUG calling RPC method: db/table/view DEBUG calling RPC method: db/table/get DEBUG calling RPC method: db/table/count DEBUG calling RPC method: db/table/get DEBUG calling RPC method: db/table/get DEBUG calling RPC method: db/table/get DEBUG calling RPC method: db/table/get DEBUG calling RPC method: db/table/get DEBUG calling RPC method: db/table/get DEBUG calling RPC method: db/table/get DEBUG calling RPC method: db/table/get DEBUG calling RPC method: db/table/get DEBUG calling RPC method: db/table/get DEBUG calling RPC method: db/table/get DEBUG calling RPC method: db/table/get DEBUG calling RPC method: db/table/get DEBUG calling RPC method: db/table/get DEBUG calling RPC method: db/table/get DEBUG calling RPC method: db/table/get DEBUG calling RPC method: db/table/get DEBUG calling RPC method: db/table/get DEBUG calling RPC method: db/table/get DEBUG calling RPC method: db/table/get DEBUG calling RPC method: db/table/get DEBUG calling RPC method: db/table/get DEBUG calling RPC method: db/table/get DEBUG calling RPC method: db/table/get DEBUG calling RPC method: db/table/get DEBUG calling RPC method: db/table/get DEBUG calling RPC method: db/table/get DEBUG calling RPC method: db/table/get DEBUG calling RPC method: db/table/get DEBUG calling RPC method: db/table/get DEBUG calling RPC method: db/table/get DEBUG calling RPC method: db/table/get DEBUG calling RPC method: db/table/get DEBUG calling RPC method: db/table/get DEBUG calling RPC method: db/table/get DEBUG calling RPC method: db/table/get DEBUG calling RPC method: db/table/get DEBUG calling RPC method: db/table/get DEBUG calling RPC method: db/table/get DEBUG calling RPC method: db/table/get DEBUG calling RPC method: db/table/get DEBUG calling RPC method: db/table/get DEBUG calling RPC method: db/table/get DEBUG calling RPC method: db/table/get DEBUG calling RPC method: db/table/get DEBUG calling RPC method: db/table/get DEBUG calling RPC method: db/table/get DEBUG calling RPC method: db/table/get DEBUG calling RPC method: db/table/get DEBUG calling RPC method: db/table/get WARNING skipping spf policy check because the smtp server address could not be reliably detected INFO writing the client configuration to disk DEBUG loading GTK builder object with id: LoginDialogBase.button_connect DEBUG loading GTK builder object with id: LoginDialogBase.entry_server DEBUG loading GTK builder object with id: LoginDialogBase.entry_username DEBUG loading GTK builder object with id: LoginDialogBase.entry_password DEBUG loading GTK builder object with id: LoginDialogBase.label_main DEBUG calling RPC method: campaign/landing_page/new Exception in thread Thread-5: Traceback (most recent call last): File "/usr/lib/python3.4/threading.py", line 920, in _bootstrap_inner self.run() File "/opt/king-phisher/king_phisher/client/mailer.py", line 478, in run emails_total = self.count_messages() File "/opt/king-phisher/king_phisher/client/mailer.py", line 427, in countmessages return sum(1 for in self.iterate_targets()) File "/opt/king-phisher/kingphisher/client/mailer.py", line 427, in return sum(1 for in self.iterate_targets()) File "/opt/king-phisher/king_phisher/client/mailer.py", line 458, in iterate_targets last_name=raw_target['last_name'].strip(), AttributeError: 'NoneType' object has no attribute 'strip'

DEBUG idle loader routine called DEBUG calling RPC method: db/table/get DEBUG calling RPC method: db/table/view DEBUG calling RPC method: db/table/view DEBUG calling RPC method: db/table/count DEBUG idle loader routine called DEBUG calling RPC method: db/table/get DEBUG calling RPC method: db/table/view DEBUG calling RPC method: db/table/view DEBUG calling RPC method: db/table/count

wolfthefallen commented 7 years ago

From the stack track provided it appears that your csv file does not have all the required fields. It should be first_name, last_name, email_address so your file inside of a text editor should look something like.

first,last,email0@test.com
first,,email1@test.com
,,email2@test.com

Note I have comma separating the required fields even if there is no data present. Also if you are using any of the Jinja variables of first_name or last_name in the email template you must have that entry for each email address.

b3nny0 commented 7 years ago

That did it. I created my csv's in windows then copied to the ubuntu machine and everything looked ok. What I am finding is that I need to open the csv in libreoffice, resave it, then it is working. Not sure if it is a formatting thing or what, but that is working.

Thanks for the help! Appreciate it.

zeroSteiner commented 7 years ago

For my own record: As of commit a3ae3343 the details regarding a malformed line in the CSV file will be logged both the the standard logging output as well as that which is shown in the "Send" tab. Should be very useful for tracking down the exact line that is malformed.

Example output:

...
Sending email 16 of 20 with UID: qn0f9QTMrKwlk3L0 to 15@example.com
Target CSV line 17 skipped due to missing field: email address
Sending email 17 of 20 with UID: 3UNUtQoaJbLw6GeD to 16@example.com
...