Registry editor and batch files equivalent in OSX?

Discussion in 'Mac Programming' started by bluephoenix71, Aug 26, 2015.

  1. bluephoenix71, Aug 26, 2015
    Last edited by a moderator: Sep 1, 2015

    bluephoenix71 macrumors newbie

    Sep 3, 2012
    Hi all,

    I need your help, this is my 2nd Mac Book pro and I am very happy with it!

    Unfortunately I need to run a program much like esxi that can run multiple host system inside of it. I need to use wireshark and secure crt to open up those host machines from my mac.

    the program is a linux program that is run via vmware fusion. and I need to be able to open up the devices using the following tools or programs.
    Ultra VNC ( to remotely access the windows host inside the esxi like program
    Secure CRT (a telnet or ssh tool to access the host inside the esxi like program
    Wireshark ( a sniffer tool that can monitor traffic between the host machines inside the esxi like program.

    Below is the sample scripts, I would like to know if there are experts in OSX or scripting that could guide me on what files to edit in my OSX maverick laptop.

    @echo OFF
    SET USERNAME="root"
    SET PASSWORD="unl"
    SET S=%1
    SET S=%S:capture://=%
    FOR /f "tokens=1,2 delims=/ " %%a IN ("%S%") DO SET HOST=%%a&SET INT=%%b
    IF "%INT%" == "pnet0" SET FILTER=" not port 22"
    Windows Registry Editor Version 5.00
    @="\"C:\\Program Files\\UNetLab\\ultravnc_wrapper.bat\" %1"
    ECHO "Connecting to %USERNAME%@%HOST%..."
    "C:\Program Files\UNetLab\plink.exe" -ssh -pw %PASSWORD% %USERNAME%@%HOST% "tcpdump -U -i %INT% -s 0 -w -%FILTER%" | "C:\Program Files\Wireshark\Wireshark.exe" -k -i -
    @echo OFF
    SET S=%1
    SET S=###%S%###
    SET S=%S:"###=%
    SET S=%S:###"=%
    SET S=%S:###=%
    SET S=%S:vnc://=%
    start "VNCViewer" "C:\Program Files\uvnc bvba\UltraVNC\vncviewer.exe" -connect %S% -shared
    Windows Registry Editor Version 5.00
    @="URL:Telnet Protocol"
    "URL Protocol"=""
    @="\"C:\\Program Files\\VanDyke Software\\SecureCRT\\SecureCRT.exe\" %1 /T"
    @="URL:SSH Protocol"
    "URL Protocol"=""
    @="\"C:\\Program Files\\VanDyke Software\\SecureCRT\\SecureCRT.exe\" %1 /T"
  2. old-wiz macrumors G3

    Mar 26, 2008
    West Suburban Boston Ma
  3. avflinsch macrumors member

    Jul 14, 2011
    registry editor - no such thing, Mac's use plist files, which are sort of like plain old fashioned config files, just in a xml like format.

    batch files - just like the rest of the Unix world - OSX uses shell scripts.
  4. bluephoenix71 thread starter macrumors newbie

    Sep 3, 2012
    anyone can get to analyze above and create a script for osx?
  5. balamw Moderator


    Staff Member

    Aug 16, 2005
    New England
    MOD NOTE: I moved the thread to Mac Programming as that's where our scripting experts "live". I also edited your CODE tags to separate the batch files from Registry stuff.

  6. superscape macrumors 6502a


    Feb 12, 2008
    East Riding of Yorkshire, UK
    Might be easier if you could explain what you want a shell script to do? Looks like your examples start vnc/ssh sessions to me but I'm no expert in whatever language they're written in, and certainly not on Windows. If I understood exactly what they're meant to do then I might be able to help though.
  7. Mikael H macrumors 6502a

    Sep 3, 2014
    "ESXi-like program": Depending on what you want to do, you may try VirtualBOX (which is free, but a bit limited), or, for example, VMWare Fusion Pro. If you will be working with virtual LANs, I think you will require the pro version of Fusion, not the cheaper regular one. I have to confess that I'm not sure if you'll be able to achieve proper network sniffing between virtual machines using a desktop virtualization platform; I'd recommend you do download a limited-time demo version first, to create a proof-of-concept.

    VNC client
    : I think the most common one for Mac is called "Chicken of the VNC", and is free. Other VNC clients are available, and usually free. Depending on what you want to achieve, it might be a better idea to open up the Windows host for remote desktop access and simply run an RDP client (either from Microsoft, or a third-party one like CoRD (free) or Royal TSX (paid).

    SSH client
    : Your Mac comes with an ssh client preinstalled. Just launch "Terminal" and type ssh username@hostname, and you're good to go.

    : Available for all relevant platforms. Depending on your use case, you'll have to run it on the appropriate computer for your setup.

    Regarding your scripts and registry settings:
    I have a feeling that the scripts and registry settings you've pasted simply are connection strings for your remote control sessions, am I right? In that case, forget about those. You need the correct host names (or IP addresses) and valid logon credentials, that's all.
  8. balamw Moderator


    Staff Member

    Aug 16, 2005
    New England
    There seems to be just a little bit more to it than that. There's some use of command line arguments to the batch files (%1) and some complicated construction of strings (SET S = %S ...) that I'm sure could be better handled as a regular expression. Seems like the process can target several machines specified from the command line.

    I agree that the registry stuff is just settings for the ssh and VNC clients.

    FWIW Screen Sharing is the built in VNC client that ships with OS X. You really have no need for any third party software besides Wireshark. e.g.

  9. Mikael H macrumors 6502a

    Sep 3, 2014
    Wow, I can't believe I didn't think of that. Well, that says a bit about how much I use VNC...
  10. ArtOfWarfare macrumors G3


    Nov 26, 2007
    Screen Sharing is missing a few features (I honestly can't remember which... Might be port settings I wanted or something?) so I use RealVNC instead.
  11. bluephoenix71 thread starter macrumors newbie

    Sep 3, 2012

    I just want to find a way to click on a device in vm environment (example is a windows machine) and open it up via vnc. If you guys are familiar with GNS3/UNL/VIRL, you can click on a network, server topology and the device will open up in secureCRT, putty, terraterm using telnet or ssh.
    I just wanted the same thing to happen in OSX.... my friend said that you can easily do it in windows and mocked my OSX as a typewriter that can't do anything (crying inside boohooo)
  12. bluephoenix71 thread starter macrumors newbie

    Sep 3, 2012
    @Mikael H

    In windows, you can use UNETLAB or GNS3 (it's a platform that integrates network platforms ie routers, switches, firewalls, windows OS, Linux, Load Balancers and others...

    The VMware fusion acts like a router since it has all the subnets that will connect all of those instances, which means I can create a lab using private IP addresses and it will not go out of my network.

    Now the UNL author was able to give registry editor scripts and batch files so that you can open those VM instances inside UNL.

    The registry editor above is the one used for UNL. I asked the guy if he can replicate that script in OSX fashion but he doesn't use MAC

    Attached Files:

  13. bluephoenix71 thread starter macrumors newbie

    Sep 3, 2012

    I did use screen sharing but it is pointing to the IP address of the host (my MAC). The windows instance I need vnc to work is in the UNL ( kinda like GNS3) and it has it's own private address that is not seen on the outside network of my MAC.
  14. bluephoenix71 thread starter macrumors newbie

    Sep 3, 2012
    I am running vmware fusion in my mac and running a vm image of UNL (Linux based application)
    This software is capable of running different network and server machines inside of it and connect them in a network lab scenario. Much like GNS3 if you are familiar with it... Once you have installed UNL and have the necessary images for your devices or servers or desktop, you can then http to UNL using the dhcp ip it acquires. UNL application program.PNG

    Now in windows, there is a batch file or script, and a registry editor that makes secureCRT, wireshark, and VNC connect and open a session inside the UNL application that is running in VMware fusion. I will attach again the file I have captured so you can understand a little bit more...

    Now once you click those arrows, the devices will open a secureCRT or ssh tool (if you run the script and registry editor in windows)

    Now if I connect a desktop machine (windows OS) once I click on it it will open a VNC session to that machine (If you run the script and the registry editor)

    Could you help convert the scripts or we can skype so I can share my screen with you live? I just need this to run on OSX so I can continue with my work, you see I need to run different network scenarios for clients and test the configuration before deploying to their network...

    My id is bluephoenix71
  15. ocabj macrumors 6502a


    Jul 2, 2009
    Are those scripts even supposed to be executed in the host OS? I figure you would execute them in the respective VMs you light up in your lab environment.

    For example, those scripts for securecrt and vncviewer execute .exe binaries. Those are Windows binaries, not Mac binaries. Even if you were to convert those batch scripts to shell (e.g. bash or tcsh) scripts, you're not going to be able to make a system call to a Windows executable from within OS X.

    I don't have any idea how UNL works, but if the exercises designed to use UNL are like the training courses I've been in that utilized a virtual lab environment, you don't execute any of the lab programs from within your host OS. Everything is done inside the VMs. This is whole point of creating a virtual environment.
  16. bluephoenix71 thread starter macrumors newbie

    Sep 3, 2012
    Thanks for the reply, those exe files I know can only be opened on windows. What I mean is that those programs or apps
    * They have their equivalent apps in OSX *
    What I am trying to achieve is that if anybody who is an expert in OS scripting (Windows and OSX) can interpret what the batch and registry editor files do for this program
    * This program basically integrates all the VM instance or images of different network, security, server platforms and connects them together to form a lab environment where you can play around and experiment on different setups and designs.
    Now when you click on the network icons on the program,
    -if it's a network device and you configure it to be accessed via telnet or ssh, the batch files and registry editor will then automatically call either putty, securecrt or terminal if you can point to it.
    -if it's a windows icon, the batch and registry file enables to open that server or desktop image/instance via vnc.

    Please let me know if I have clarified it for you and just let me know if you need further information.

    Again, I am willing to converse via skype if needed. id is bluephoenix71
  17. rthpjm, Sep 4, 2015
    Last edited: Sep 5, 2015

    rthpjm macrumors 6502a


    Jan 31, 2011
    If I am correct, what you want to do is:
    Click on one of the icons shown on the web page and launch an external application.

    It would appear that I was completely wrong!!!

    It looks like you will not need to do anything (no editing of scripts, and definitely nothing equivalent of registry changes!). It should "just work" in the good old Apple tradition. I haven't tried with unetlab directly, but I did create a simple web page with a vnc, telnet, and ssh link. When I clicked on each link, MacOSX/Safari simply launched the Screen Sharing application for VNC, the terminal for telnet, and the terminal for ssh.

    I will try a test install of unetlab later and edit this post again with the results...

    -----------------End edit-----------------

    This isn't easy on MacOSX with Safari, deliberately so. It comes down to security, this is exactly the kind of "attack vector" that malicious web coders would love to exploit. These things are often called "drive-by" malware.

    ----------Edit 2--------
    I tried unetlab in Oracle's VirtualBox. It is based on Ubuntu. It appears that unetlab then "manages" other virtual machines as you add the "nodes" of your virtual network. I couldn't test further because the nodes need to be downloaded. All the ones I tried needed an account/login before download. E.g the Cisco ASA virtual machine.
    Care needs to be taken when setting up the unetlab "clouds" which are effectively bridged networks. So long as they are set up okay then I think the "it will just work" is still a valid statement
    ------- End edit 2 -------

    The easiest advice I can give you is to learn how to use the external apps without the convenience of "clicking on the icon". If unetlab server displays a tooltip when you hover over the icon, does it show you the IP address of the object you're trying to reach?

    On your Mac you can open the Terminal app. Do you know how to do that? (It's in Applications > Utilities)
    With a terminal open, simply use the command line, you don't need SecureCRT, you can run telnet sessions and/or secure shell sessions from the terminal
    The general syntax is:
    ssh user@

    Similarly you can use the Screen Sharing app as you VNC client, from the Finder use the key combination shift+cmd+G, or use the Go menu > Go to folder menu item. When the input window is presented type:

    Note: change the values of or to match your target machine/object. The 5901 port number may need to change too. VNC uses display numbers and the network communications map the display number to a port. Display number zero 0 is usually mapped to port 5900, display 1 to port 5901. In general then display N is mapped to port 5900+N. (Display 0 is usually reserved for the login screen with VNC, display 1 and above are usually mapped to users, for unetlab they will probably map to the virtual servers)

    All of the above presumes that you can reach the target machine/object from the Mac, but what you are describing might not allow that.....

    I have a sneaking feeling that the unetlab software is a virtual environment within a virtual environment.
    If your Mac is the host system, and you have VMWare Desktop installed with a virtual machine built as a guest operating system, and THEN you run unetlab inside that guest, then I think you may be looking at the wrong layer. You should probably be looking at the guest OS (not the host Mac).

    Are you using VMWare and building a Windows guest, and then installing unetlab into the guest?
  18. bluephoenix71, Sep 8, 2015
    Last edited by a moderator: Sep 8, 2015

    bluephoenix71 thread starter macrumors newbie

    Sep 3, 2012
    Thanks for your interest in my post!

    You are right UNETLAB is a virtual machine inside the VMware fusion Hypervisor. The UNETLAB can launch multiple operating systems (depends on RAM) for different platforms (Linux, Windows, Cisco, Alcatel, Veos etc..)

    Is there a way for you to interpret the script and maybe create a step by step equivalent in OSX?

    Attached Files:

  19. rthpjm macrumors 6502a


    Jan 31, 2011
    Hi bluephoenix71

    I'll say it again. You can skip that step. There is absolutely no need for it. You do NOT need those scripts they are Windows-only.

    On MacOSX with Safari, clicking on the icon will automatically bring up the right application, (with the exception of Wireshark).

    Safari understands the telnet://address, ssh://address, and vnc://address URLs natively.
    Safari does not understand the URL capture://host/interface

    Unfortunately Wireshark on MacOSX (even the development build 1.99.x) does not yet support remote interfaces. Therefore, your best bet is to break it down into the steps and perform them manually yourself:
    • SSH onto the unetlab VM and perform the network capture to a file using tcpdump
    • [Do the actions in the lab that you are investigating]
    • stop the tcpdump capture
    • Open Wireshark
    • Open the capture file within Wireshark
    1. Open up the MacOSX Terminal application (/Applications/Utilities/Terminal)
    2. type
    3. ssh root@ tcpdump -U -i pnet0 -s 0 -w - 'not port 22' > ~/Desktop/unetlab.pcap
    4. unl
    5. [Do your actions in the lab]
    6. press ctrl+C to stop the tcpdump
    Change the address to suit your unetlab address, change pnet0 to match the network interface you need to monitor. Change the filename unetlab.pcap if you don't want to keep overwriting the file.

    At this point you should now have the pcap file on your Desktop. Start Wireshark and File > Open

    NOTE: on my downloaded unetlab VM, the tcpdump program is not installed.
    • ssh onto your vm
    • ssh root@
    • unl
    • apt-get install tcpdump
  20. rthpjm, Sep 8, 2015
    Last edited: Sep 8, 2015

    rthpjm macrumors 6502a


    Jan 31, 2011
    I was going to look and see if I could get the capture:// URL to work via a script for you, but someone else has already done it, why re-invent the wheel?!

    Drop his app into /Applications

    Then when you first choose Capture from the within your running lab, Safari will find UNL_Wireshark as if by magic.

    If you're running on a recent version of MacOSX, Gatekeeper might pop up a dialog box saying UNL_Wireshark is from an unidentified developer, click okay. Then open System Preferences, click the Security & Privacy icon, there should be an Open Anyway button, click it (you only need to do this once)

Share This Page