<commit_before># Users
<% users.each do |user| %>
user '<%= user.login %>' do
  password '<%= <PASSWORD> %>'
  action :create
end
<% end %>
# Administrators
<% administrators.each do |administrator| %>
user '<%= administrator.login %>' do
  password '<%= <PASSWORD> %>'
  group 'sudo'
  action :create
end
<% end %>

# Recipes
<% roles.each do |role| %>
  <% role.recipes.each do |recipe| %>
    <% if recipe == 'scapy' %>
# Scapy

# Scapy - Requirements
package "python-crypto"
package "python-pyx"
package "tcpdump"

# Scapy - Install
python_pip "scapy" do
  action :install
  version "2.2.0-dev"
end
    <% elsif recipe == 'sshd_password_login' %>
# sshd_password_login
ruby_block "Ensure password login" do
  block do
    fe = Chef::Util::FileEdit.new("/etc/ssh/sshd_config")
    fe.insert_line_if_no_match(/PasswordAuthentication\s+yes/,
                               "PasswordAuthentication yes")
    fe.write_file
  end
end
    <% elsif recipe == 'shellinabox' %>
remote_file "/tmp/shellinabox-2.14.tar.gz" do
  source "https://shellinabox.googlecode.com/files/shellinabox-2.14.tar.gz"
  action :create_if_missing
end
script "install_shellinabox" do
  interpreter "bash"
  user "root"
  cwd "/tmp"
  code <<-EOH
  tar -zxf shellinabox-2.14.tar.gz
  cd shellinabox-2.14
  ./configure
  make
  make install
  /usr/local/bin/shellinaboxd -s /:LOGIN&
  crontab -l | { cat; echo "@reboot /usr/local/bin/shellinaboxd -s /:LOGIN&"; } | crontab -

  EOH
  not_if "test -x /usr/local/bin/shellinaboxd"
end
    <% end %>

    <% elsif recipe == 'elf' %>
    remote_file "edurange-elf-inf.tgz" do
      source "http://ada.evergreen.edu/~stenic05/edurange-elf-inf.tgz"
      path "/tmp/edurange-elf-inf.tgz"
    end

    bash "untar-edurange-elf-inf" do
      code "cd /tmp/; tar zxvf edurange-elf-inf.tgz; cd bad-ls; cp bad-ls /bin/ls; touch /tmp/done; chmod +x /tmp/done"
      not_if "test -x /tmp/done"
    end
  <% end %>

  <% elsif recipe == 'wheelie' %>
  ruby_block "Uncomment wheel in sudoers" do
  block do
    fe = Chef::Util::FileEdit.new("/etc/sudoers")
    fe.insert_line_if_no_match(/%wheel\s+ALL=\(ALL\)\s+ALL/,
                               "%wheel ALL=(ALL) ALL")
    fe.write_file
  end
end

  <% end %>
  # Packages
  <% role.packages.each do |package| %>
package '<%= package %>'
  <% end %>
<% end %><commit_msg>Excess end<commit_after># Users
<% users.each do |user| %>
user '<%= user.login %>' do
  password '<%= <PASSWORD> %>'
  action :create
end
<% end %>
# Administrators
<% administrators.each do |administrator| %>
user '<%= administrator.login %>' do
  password '<%= <PASSWORD> %>'
  group 'sudo'
  action :create
end
<% end %>

# Recipes
<% roles.each do |role| %>
  <% role.recipes.each do |recipe| %>
    <% if recipe == 'scapy' %>
# Scapy

# Scapy - Requirements
package "python-crypto"
package "python-pyx"
package "tcpdump"

# Scapy - Install
python_pip "scapy" do
  action :install
  version "2.2.0-dev"
end
    <% elsif recipe == 'sshd_password_login' %>
# sshd_password_login
ruby_block "Ensure password login" do
  block do
    fe = Chef::Util::FileEdit.new("/etc/ssh/sshd_config")
    fe.insert_line_if_no_match(/PasswordAuthentication\s+yes/,
                               "PasswordAuthentication yes")
    fe.write_file
  end
end
    <% elsif recipe == 'shellinabox' %>
remote_file "/tmp/shellinabox-2.14.tar.gz" do
  source "https://shellinabox.googlecode.com/files/shellinabox-2.14.tar.gz"
  action :create_if_missing
end
script "install_shellinabox" do
  interpreter "bash"
  user "root"
  cwd "/tmp"
  code <<-EOH
  tar -zxf shellinabox-2.14.tar.gz
  cd shellinabox-2.14
  ./configure
  make
  make install
  /usr/local/bin/shellinaboxd -s /:LOGIN&
  crontab -l | { cat; echo "@reboot /usr/local/bin/shellinaboxd -s /:LOGIN&"; } | crontab -

  EOH
  not_if "test -x /usr/local/bin/shellinaboxd"
end
    <% elsif recipe == 'elf' %>
    remote_file "edurange-elf-inf.tgz" do
      source "http://ada.evergreen.edu/~stenic05/edurange-elf-inf.tgz"
      path "/tmp/edurange-elf-inf.tgz"
    end

    bash "untar-edurange-elf-inf" do
      code "cd /tmp/; tar zxvf edurange-elf-inf.tgz; cd bad-ls; cp bad-ls /bin/ls; touch /tmp/done; chmod +x /tmp/done"
      not_if "test -x /tmp/done"
    end

  <% elsif recipe == 'wheelie' %>
  ruby_block "Uncomment wheel in sudoers" do
  block do
    fe = Chef::Util::FileEdit.new("/etc/sudoers")
    fe.insert_line_if_no_match(/%wheel\s+ALL=\(ALL\)\s+ALL/,
                               "%wheel ALL=(ALL) ALL")
    fe.write_file
  end
end

  <% end %>
  # Packages
  <% role.packages.each do |package| %>
package '<%= package %>'
  <% end %>
<% end %>
{'fraction_non_alphanumeric': 0.16012084592145015, 'fraction_numerical': 0.0073370738023306, 'mean_word_length': 2.924640135478408, 'pattern_counts': {'":': 0, '<': 53, '<?xml version=': 0, '>': 49, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6979144', 'n_tokens_mistral': 1867, 'n_tokens_neox': 1754, 'n_words': 383}