Search This Blog

Monday, April 9, 2018

Install a package without apt-get on kali

Get the zip/tarball from wget

wget tar/bz2
bzip2 file
tar xzf // will give tar
tar xvf // will give folder
./configure
make
make check
make install

Build whatsapp plugin on wireshark

The old code on GitHub for building whatsapp.so isnt working anymore with the new libwireshark-dev.

You need to clone the git on your kali system using

$git clone https://github.com/davidgfnet/wireshark-whatsapp

mkdir build

cd build

cmake ..

but this will error out because you need to update the CMakefile.txt with the wireshark include dirs and cmake install directories(if you dont have cmake, do an apt-get install cmake and make sure you include the dir in the cmake file)

Sample entries

set(WIRESHARK_INCLUDE_DIRS /usr/include/wireshark)
set(GCRYPT_INCLUDE_DIR /usr/local/include)


Just include them in the CMakeLists.txt top section, make sure Gcrypt is installed)

Good idea to read the readme again on the above git, you need some kind of dependencies before this build can succeed.

There were some modifications required to make this git build work with the newest version of libwireshark-dev, I created a pull request on the git and patched the code.

If the owner accepts my pull you can use the git mentioned above, you can also use my forked one here

image


$ make install

image

  P.S Make sure you do apt-get update before doing any thing and include dependencies before running cmake or make.

image


// Wireshark version 2.4.5 libwireshark-dev 2.4.5

Sunday, April 1, 2018

Minishift ( the openshift origin local installation) not starting on windows


To start minishift on windows, you need to have two prereq.

ssh client should be there in path, either cygwin or ssh runtime which comes with windows 10, you can enable it from the features.

also you will need to set the cygwin waring flat either in the command prompt from where you are starting minishift or from the profile. cmd > set CYGWIN=nodosfilewarning // now start mini


cmd> minishift start –vm-driver=virtualbox

This should start the cluster and , minishift status should give you that openshift is running.

You can also try minishift update , it might fix errors you getting.

Also you can set the size of the instances if you are getting space issues while starting minishift, this can be set as a command line parameter while starting minishift. //--disk-size 10g


Troubleshoot:

If you want to recreate the machine, you can delete it from the ~/.minishift/machines/minishift folder and its json and restart minishift, it will pull the openshift 3 again with layers and will start afresh, this is just in case your current config has gone bonkers.

Saturday, March 31, 2018

Host private docker registry and connect to it ( Windows version)

If you don’t want to use dockerhub you can host your own private registry.

Get a registry image from docker hub and host it in a container as shown below.

image

$docker pull registry // also works from toolbelt

I used kitematic, you can dirctly pull from command line also, make sure you map port 5000,

where the docker registry api listens for calls.

so my registry now listening on

image


Lets connect to it and see the content.


Use curl to fire api call to registry endpoint


$ curl -v -X GET http://192.168.99.102:32768/v2/_catalog
Note: Unnecessary use of -X or --request, GET is already inferred.
* timeout on name lookup is not supported
*   Trying 192.168.99.102...
* Connected to 192.168.99.102 (192.168.99.102) port 32768 (#0)
> GET /v2/_catalog HTTP/1.1
> Host: 192.168.99.102:32768
> User-Agent: curl/7.46.0
> Accept: */*
>
< HTTP/1.1 200 OK
< Content-Type: application/json; charset=utf-8
< Docker-Distribution-Api-Version: registry/2.0
< X-Content-Type-Options: nosniff
< Date: Fri, 30 Mar 2018 14:04:22 GMT
< Content-Length: 20
<
{"repositories":[]}
* Connection #0 to host 192.168.99.102 left intact


I used docker tool belt, i was on windows, it has curl on it.


So i could connect but there are no repositories currently.

Tag the image to puch to local repository

So the way to push a docker image locally to another private registry is by

naming it in such a way that the name has the url port and the image information.

so lets say we have hello-world image in > docker images

To pull it form dockerhub we do

docker run hello-world , it brings the image and run it and saves an image locally.

To push this hello-world image to our private repository , we will tag it like this.

> docker tag hello-world 192.168.99.102:32768/hello-world

Now it will automatically push it to the url  port and the image name specified, this is kind of a

trick to push images from local space to a private registry.


=======================


Lets try to push the image

> docker push 192.168.99.102:32768/hello-world

It ended up with error

 http: server gave HTTP response to HTTPS client

Multiple ways to solve this

If you natively on docker for windows, you can directly specify in preferences.

==============================

If you are using docker on unix, you can try to ssh into the minishift vm and add the daemon.json file in

the /etc/docker/daemon.json and sudo service docker restart(Should work)


// daemon.json file content

{
  "insecure-registries" : ["registry:5000"]
}


Tip *To ssh in to minishift vm or any docker vm running via tool belt on windows,you can do this

locate the id_rsa for that machine in the user profile folder and fire a ssh.

//

ssh -i ~/.minishift/machines/minishift/id_rsa docker@url


=============================

If you are on windows with toolbelt, you can ssh into your boot2docker vm and update the /var/lib/boot2docker/profile  and add docker opts for insecure registry as shown below

DOCKER_OPTS="--insecure-registry url:5000"

restart docker service and test again by pushing the image.

You should be able to push your image now.


Ref url

you can test your repo availability by  

$curl url:Port/v2/_ping

$curl url:Port/v2/_catalog


Please not , you can also pull repository image in same docker environment and refer to the

registry container on localhost:5000 , that way you should be able to push it easily, pushing to external ip could have this allow unsecure access issues, locally it should work just fine. I fired up a vagrant box for openshift and i could pull a registry image , run a registry locally and push on localhost:5000 just like that, hey vagrant is awsome.. I just started using it.