Giter Site home page Giter Site logo

rhymeswithmogul / psgopher Goto Github PK

View Code? Open in Web Editor NEW
4.0 1.0 0.0 171 KB

A Gopher/Gopher+/SecureGopher client written in PowerShell.

Home Page: https://powershellgallery.com/packages/PSGopher/

License: GNU Affero General Public License v3.0

PowerShell 100.00%
gopher gopherplus gopher-client gopher-protocol powershell powershell-modules powershell-module powershell-core powershell-gallery pwsh powershell-cmdlets things-that-should-not-exist secure-gopher securegopher secure-gopher-plus

psgopher's Introduction

PowerShell Gallery Version PowerShell Gallery Download from PowerShell Gallery GitHub Workflow Status License: AGPL v3

PSGopher

A Gopher/Gopher+/SecureGopher client written for Powershell 7 and newer.

Installation

Grab it from PowerShell Gallery with: Install-Module PSGopher

Usage

In this example, we'll connect to Floodgap's Gopher server and return the content.

PS C:\> $response = Invoke-GopherRequest gopher://floodgap.com
PS C:\> $response.Content

Welcome to Floodgap Systems' official gopher server.
Floodgap has served the gopher community since 1999
(formerly gopher.ptloma.edu).
[…]

The syntax and output of this cmdlet is modeled after Invoke-WebRequest, going as far as to emulate some of its properties:

PS /home/colin> Invoke-GopherRequest gopher://port70.net

Protocol         : Gopher
ContentType      : 1
Content          : Welcome to the gopher server at port70.net.
                   
                   Projects:
                   mgod gopher server
                   [HTTP] FRTPLOT: Free Real-time Data Plotter
                   [HTTP] Animator - Simple 2D Vector Graphics Interpreter
                   [HTTP] Plumb - connect multiple programs with lots of pipes
                   [HTTP] cchan - "channel" construct for inter-thread communication in C programs
                   [HTTP] Stutter (LISP interpreter)
                   
                   NECRON card game
                   Gopherchan!
                   
                   
                   
Encoding         : System.Text.UTF8Encoding
Images           : 
Links            : {@{href=gopher://port70.net/mgod; Type=1; Description=mgod gopher server; Resource=/mgod; 
                   Server=port70.net; Port=70; UrlLink=False}, @{href=http://frtplot.port70.net/; Type=h; 
                   Description=[HTTP] FRTPLOT: Free Real-time Data Plotter; Resource=/; Server=frtplot.port70.net; 
                   Port=80; UrlLink=True}, @{href=http://repo.hu/projects/animator; Type=h; Description=[HTTP] 
                   Animator - Simple 2D Vector Graphics Interpreter; Resource=/projects/animator; Server=repo.hu; 
                   Port=80; UrlLink=True}, @{href=http://repo.hu/projects/plumb; Type=h; Description=[HTTP] Plumb - 
                   connect multiple programs with lots of pipes; Resource=/projects/plumb; Server=repo.hu; Port=80; 
                   UrlLink=True}…}
RawContent       : iWelcome to the gopher server at port70.net. fake    (NULL)  0
                   i    fake    (NULL)  0
                   iProjects:   fake    (NULL)  0
                   1mgod gopher server  mgod    port70.net      70
                   h[HTTP] FRTPLOT: Free Real-time Data Plotter URL:http://frtplot.port70.net   port70.net      70
                   h[HTTP] Animator - Simple 2D Vector Graphics Interpreter     URL:http://repo.hu/projects/animator
                   port70.net   70
                   h[HTTP] Plumb - connect multiple programs with lots of pipes URL:http://repo.hu/projects/plumb
                   port70.net   70
                   H[HTTP] cchan - "channel" construct for inter-thread communication in C programs
                   URL:http://repo.hu/projects/cchan    port70.net      70
                   h[HTTP] Stutter (LISP interpreter)   URL:http://hactar.port70.net/stutter    port70.net      70
                   i    fake    (NULL)  0
                   1NECRON card game    necron  port70.net      70
                   1Gopherchan! chan    port70.net      70
                   i    fake    (NULL)  0
                   
RawContentLength : 818

Gopher+ Metadata

You can use the -Abstract parameter to fetch Gopher+ information instead of the resource itself.

PS C:\> Invoke-GopherRequest -Abstract gopher://colincogle.name/0downloads/pgp.txt | Format-List

INFO     : 0pgp.txt     /downloads/pgp.txt      colincogle.name 70      +
ADMIN    : {Admin: Colin Cogle <colin@colincogle.name>, Mod-Date: Sun Nov 28 14:37:30 2021 <20211128143730>}
VIEWS    : text/plain: <5k>
ABSTRACT : Colin Cogle's PGP keys and signing policy.

Downloading Files

Finally, you can also use PSGopher's -OutFile parameter to download files (even with opportunistic encryption):

PS /Users/colin> Invoke-GopherRequest -TrySSL gopher://colincogle.name/0downloads/pgp.txt -OutFile pgp.txt
PS /Users/colin> Get-Item pgp.txt                            

    Directory: /Users/colin

UnixMode   User             Group                 LastWriteTime           Size Name
--------   ----             -----                 -------------           ---- ----
-rw-r--r-- colin            wheel                2/8/2022 08:05           5218 pgp.txt

Enjoy Gopherspace!

psgopher's People

Contributors

rhymeswithmogul avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.