- Create a Phoenix app
# create the app
mix phx.new my_app --no-ecto --module MyApp --app my_app
# go to my_app| # if you have a directory of files that look like: | |
| # 2015-03-21 11.23.39.jpg | |
| # 2015-04-15 09.55.20.jpg | |
| # 2015-03-21 11.23.42.jpg | |
| # 2015-05-12 13.14.59.png | |
| # | |
| # this Rakefile will move all the files into subdirectories for year/month | |
| task :default do |task| | |
| file_list = FileList['*.jpg', '*.png'] |
| # chat.rb | |
| require 'sinatra/base' | |
| # this also loads celluloid io, let's keep that in mind | |
| require 'celluloid/current' | |
| require 'reel' | |
| # The chat server, an IO Event Loop held by the actor | |
| # Collects connections (Reel Event Streams) | |
| # | |
| # Contrary to EventMachine, there is no event callback for |
| launchctl unload /Library/LaunchAgents/org.macosforge.xquartz.startx.plist | |
| sudo launchctl unload /Library/LaunchDaemons/org.macosforge.xquartz.privileged_startx.plist | |
| sudo rm -rf /opt/X11* /Library/Launch*/org.macosforge.xquartz.* /Applications/Utilities/XQuartz.app /etc/*paths.d/*XQuartz | |
| sudo pkgutil --forget org.macosforge.xquartz.pkg | |
| # Log out and log in |
| defmodule MyApp do | |
| use Application | |
| def start(_type, _args) do | |
| import Supervisor.Spec, warn: false | |
| children = [ | |
| Plug.Adapters.Cowboy.child_spec(:http, MyApp.Router, [], [ | |
| dispatch: dispatch | |
| ]) |
| # You will need fswatch installed (available in homebrew and friends) | |
| # The command below will run tests and wait until fswatch writes something. | |
| # The --stale flag will only run stale entries, it requires Elixir v1.3. | |
| fswatch lib/ test/ | MIX_ENV=test mix do test --stale, run --no-halt -e "IO.gets(:stdio, ''); IO.puts 'Restarting...'; :init.restart()" |
| class BlogLink | |
| def validate(attributes) | |
| # Specific BlogLink validation, we could just use ActiveModel::Validations too | |
| end | |
| def to_path | |
| '/blogs' | |
| End | |
| def to_s |
XML processing modules may be not secure against maliciously constructed data. An attacker could abuse XML features to carry out denial of service attacks, access logical files, generate network connections to other machines, or circumvent firewalls.
The penetration tester running XML tests against application will have to determine which XML parser is in use, and then to what kinds of below listed attacks that parser will be vulnerable.
| # Echo server program | |
| import socket | |
| HOST = '' # Symbolic name meaning all available interfaces | |
| PORT = 50007 # Arbitrary non-privileged port | |
| s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) | |
| s.bind((HOST, PORT)) | |
| s.listen(1) | |
| conn, addr = s.accept() |