1. Home
    1. Dashboard
    2. Search
  2. Forum
    1. Unresolved Threads
    2. Members
      1. Recent Activities
      2. Users Online
      3. Team Members
      4. Search Members
      5. Trophys
  3. Articles
  4. Blog
  5. Videos
  6. Jobs
  7. Shop
    1. Orders
  • Login or register
  • Search
This Thread
  • Everywhere
  • This Thread
  • This Forum
  • Articles
  • Pages
  • Forum
  • Blog Articles
  • Products
  • More Options
  1. Robotforum - Support and discussion community for industrial robots and cobots
  2. Forum
  3. Industrial Robot Support and Discussion Center
  4. KUKA Robot Forum
Your browser does not support videos RoboDK Software for simulation and programming
Visit our Mainsponsor
IRBCAM
Robotics Channel
Robotics Training
Advertise in robotics
Sponsored Ads

How to use khash.exe?

  • lomaxe
  • July 30, 2019 at 9:40 AM
  • Thread is Resolved
  • lomaxe
    Reactions Received
    1
    Trophies
    3
    Posts
    95
    • July 30, 2019 at 9:40 AM
    • #1

    Hi, guys.
    Can someone help me to understand the use of the program khash.exe? It's not clear for me from CREAD, CWRITE manual.

    Quote

    The program khash.exe in the directory C:\KRC\UTIL\Hash of the robot controller
    is available for encrypting the password. The program khash.exe must
    be executed on the Windows shell cmdk.exe and entry of the password is required.

    If, for example, the password for the user is “kuka”, the encryption program on
    the Windows shell is called as follows: khash.exe kuka

    The encrypted password that must be used when calling krl_mount() in the
    KRL program is then displayed on the Windows shell.

    1. I can't find cmdk.exe in the system. I so understand I can use cmd.exe? Ok. I execute khash.exe on the Windows shell cmd.exe (see the attached image). Where should I look for the encrypted password.

    2. Which password should I use? For example, I have two robots in my network (rob1 and rob2). I want to have an access from rob1 to the file on the D drive of the rob2 (by CWRITE). On which robot should I execute khash.exe to get the encrypted password? Or it makes no differance?

    Images

    • picture.png
      • 8.37 kB
      • 596 × 393
      • 57

    Files

    picture.png_thumb 6.18 kB – 371 Downloads

    Edited once, last by lomaxe (July 30, 2019 at 11:08 AM).

  • Go to Best Answer
  • Online
    panic mode
    Reactions Received
    1,278
    Trophies
    11
    Posts
    13,079
    • July 30, 2019 at 2:33 PM
    • #2

    use command prompt (cmd.exe) and do not use START command here - it runs process in separate space and output will not be visible here.


    And navigate to correct folder where khash.exe is:

    C:\
    CD C:\KRC\UTIL\KHASH
    HASH

    last line will run program without parameters and just display help. [/size][size=small]this is common for all command line programs. but more importantly it shows if you can get something useful here. note that when launching program, extension of executables do not needed so .EXE, .COM, .CMD or .BAT can be omitted.

    then use it according to help (in case that differs from documentation)

    then type

    HASH 68kuka1secpw59

    and you sill see the password encrypted...

    Images

    • khash.jpg
      • 54.4 kB
      • 700 × 361
      • 87

    Files

    khash.jpg_thumb 13.12 kB – 365 Downloads

    1) read pinned topic: READ FIRST...

    2) if you have an issue with robot, post question in the correct forum section... do NOT contact me directly

    3) read 1 and 2

  • lomaxe
    Reactions Received
    1
    Trophies
    3
    Posts
    95
    • August 2, 2019 at 11:11 AM
    • #3

    Hi, panic mode
    Thanks, it works.
    But now I have another issue.
    I have two robots. I want to have access to the files on Rob2 from Rob1 (using KRL program). The both robots are connected to the company network and I have access to them from my office laptop.
    I executed khash.exe on Rob2 and got the encrypted password (For encryption I used the standard kuka password: 68kuka1secpw59)
    Now I try to create a mount point by calling krl_mount() function:

    Code
    CWRITE($FCT_CALL, State, Mode, "krl_mount", "/TestMount", "//192.168.200.155/D/Backup", "KUKAUser", "0E76390E88C27932C9816D326AF12CEA2B")

    But CWRITE returns the error: Operation failed: invalid user, incorrect password, mount point
    not available, file not available, etc.

    Don't understand what I do wrong. Maybe I should use the other data for USERNAME and PASSWORD? ???

  • Online
    panic mode
    Reactions Received
    1,278
    Trophies
    11
    Posts
    13,079
    • August 2, 2019 at 2:15 PM
    • #4

    i would say do it in incremental steps.... before attempting to mount something on another machine, try to map something that is on existing machine, maybeon C:\ then on D:\
    And try to make external drive mapped to your robot, maybe as E:\ in which case it should be same to use as previous point.

    1) read pinned topic: READ FIRST...

    2) if you have an issue with robot, post question in the correct forum section... do NOT contact me directly

    3) read 1 and 2

  • lomaxe
    Reactions Received
    1
    Trophies
    3
    Posts
    95
    • August 2, 2019 at 2:28 PM
    • #5
    Quote

    try to map something that is on existing machine, maybeon C:\ then on D:\

    Do you mean trying to get access to the machine on which I execute KRL program?
    If yes, I did this way. Firstly on D:\ and then on C:\. I executed the program on Rob1 (ip 192.168.200.154) and used the code:

    Code
    CWRITE($FCT_CALL, State, Mode, "krl_mount", "/TestMount", "//192.168.200.154/D/Backup", "KUKAUser", "0E76390E88C27932C9816D326AF12CEA2B")

    Is that right?

  • Online
    panic mode
    Reactions Received
    1,278
    Trophies
    11
    Posts
    13,079
    • August 2, 2019 at 11:15 PM
    • #6

    good idea but i don't think that will work... if you are trying to access local drive you need to use local IP address and - that is NOT the KLI address. in fact you cannot even ping your own KLI port from the controller.... well, not from Windows at least and that is where file sharing takes place.

    1. login and minimize HMI
    2. create folder such as D:\test
    3. make sure to SHARE this folder with the specific user account you plan on using, such as KukaUser
    4. return to HMI
    5. create test program using LOCAL network address such as 192.168.0.1. For example:

    CWRITE($FCT_CALL, State, Mode, "krl_mount", "/test", "//192.168.0.1/test", "KukaUser", "0E76390E88C27932C9816D326AF12CEA2B")


    Try and see if you get OK

    1) read pinned topic: READ FIRST...

    2) if you have an issue with robot, post question in the correct forum section... do NOT contact me directly

    3) read 1 and 2

  • lomaxe
    Reactions Received
    1
    Trophies
    3
    Posts
    95
    • August 5, 2019 at 10:18 AM
    • #7
    Code
    CWRITE($FCT_CALL, State, Mode, "krl_mount", "/test", "//192.168.0.1/test", "KukaUser", "0E76390E88C27932C9816D326AF12CEA2B")

    It works. The command was executed without any error. Then I try opening a file:

    Code
    CWRITE ($FCT_CALL, State, Mode, "krl_fopen", "/test/test.txt", "w", nHandle, #FULL_BUFF)

    but have an error: Mount point not found :hmmm:

    Edited once, last by lomaxe (August 5, 2019 at 12:28 PM).

  • Online
    SkyeFire
    Reactions Received
    1,051
    Trophies
    12
    Posts
    9,423
    • August 5, 2019 at 3:24 PM
    • #8

    What are the contents of the State variable immediately following each command?

  • lomaxe
    Reactions Received
    1
    Trophies
    3
    Posts
    95
    • August 5, 2019 at 3:48 PM
    • #9

    After the first command (krl_mount):

    Code
    STATE={STATE_T: RET1 #DATA_OK, MSG_NO 0, HITS 0, LENGTH 0}

    After the second command (krl_fopen):

    Code
    STATE={STATE_T: RET1 #CMD_ABORT, MSG_NO -32, MSG_TYPE "D", HITS 0, LENGTH 0}
  • Online
    panic mode
    Reactions Received
    1,278
    Trophies
    11
    Posts
    13,079
    • August 5, 2019 at 4:00 PM
    • #10

    hmmmm... that is weird. what KSS?

    1) read pinned topic: READ FIRST...

    2) if you have an issue with robot, post question in the correct forum section... do NOT contact me directly

    3) read 1 and 2

  • Online
    panic mode
    Reactions Received
    1,278
    Trophies
    11
    Posts
    13,079
    • August 5, 2019 at 4:24 PM
    • #11

    KSS8.3.34 complains with MSG_NO value -2
    (Operation failed, e.g. because the file was opened outside a KRL program or the mode is “r”, “r+”, “rb” or “rb+”, but the file does not exist.")

    KSS8.5.6 shows MSG_NO value -32
    (Mount point not found)


    KSS8.3 response is a nonsense since attempt is to create new file using "w" mode.I would guess that CWRITE in KSS8.5 was modified to provide less ambiguous message of the problem. Still does not explain why mount command was reporting success....

    1) read pinned topic: READ FIRST...

    2) if you have an issue with robot, post question in the correct forum section... do NOT contact me directly

    3) read 1 and 2

  • lomaxe
    Reactions Received
    1
    Trophies
    3
    Posts
    95
    • August 6, 2019 at 7:45 AM
    • #12
    Quote from panic mode

    hmmmm... that is weird. what KSS?

    KSS 8.5.7 HF1

    Quote from panic mode

    Still does not explain why mount command was reporting success....

    Hm, looks like a bug...

  • paranoidandroid
    Reactions Received
    2
    Trophies
    3
    Posts
    26
    • January 8, 2020 at 6:10 PM
    • #13

    Hey all,

    KSS 8.5.7 HF1. Tested this both on a compact controller for an Agilus, and on a full size controller for a KR16.

    Running into a similar issue as lomaxe with krl_fopen. I'm presently trying to write to the D:/ drive (for logs), after ensuring sharing privileges have been activated. Ultimately, I'm trying to get CWRITE commands to create, and write to a file inside of the D:/ drive under a specified directory. At present, I'm not using the krl_mount command to mount the D:/ drive as lomaxe did. From what I can tell from this thread, it doesn't appear to matter as they ran into the same issue I'm seeing. I'm going to attempt to mount the D:/ drive using the local IP per Panic_Mode (credentials "KukaUser" and the "68kuka1secpw59" password hash), but at present I'm not sure this will change the end result.

    Things that we've checked:

    - External PC connected via KLI, able to ping the IP address of the KRC controller (172.31.1.147, for reference)

    - External PC can access, and write, to D:/. Meaning create directories and files, along with deletion.

    - Error value for the STATE_T structure comes out to -2, indicating "Operation failed, e.g. because the file was opened outside a KRL program or the mode is “r”, “r+”, “rb” or “rb+”, but the file does not exist.". I've ensured that my code uses the append command ("a") with krl_fopen.

    Any recommendation / direction / feedback would be greatly appreciated.

    Some portion of my code shown below:

    Code
    DEF NewLoggingTester(sText[]:IN, sModul[]:IN , iIndex:OUT) 
    
    
    
    DECL INT HANDLE, Offset, iIndex
    
    
    DECL STATE_T STAT, STATE_TE
    
    
    DECL MODUS_T MODE
    
    
    
    CHAR FileName[256], FilePath[256], ProjectName[256]
    
    CHAR sText[],sModul[]
    
    
    CHAR CarriageReturn
    CHAR LineFeed
    
    
    
    
    CarriageReturn = 13
    LineFeed = 10
    
    
    ProjectName[] = "TestProject"
    
    
    FilePath[] = "d/Log/"
    
    
    
    MODE = #SYNC
    
    
    HANDLE = 0
    
    
    
    ;FOLD Entry and Index line
    
    
    ;Edit character string
    
    
    Offset = 0
    
    
    
    
    ;FileName Creation per Month
    
    
    SWRITE(FileName[],STATE_TE,Offset,"%s%s_%02d_%d.txt",FilePath[],ProjectName[],$DATE.Month,$DATE.YEAR)
    
    
    
    
    ; create a file under D:\Log
    
    
    CWRITE($FCT_CALL, STAT, MODE, "krl_fopen", FileName[],"a", HANDLE)
    
    
     wait sec 0
    
    
     CWrite($FCT_CALL, STAT, MODE, "krl_fprintf", HANDLE, "%s: %d%c%c","Entry",iIndex,LineFeed,CarriageReturn)
    
    
     CWrite($FCT_CALL, STAT, MODE, "krl_fprintf", HANDLE, "%d-%d-%d %d:%d:%d%c%c",$DATE.year,$DATE.month,$DATE.day,$DATE.hour,$DATE.min,$DATE.SEC,LineFeed,CarriageReturn)
    
    
     CWrite($FCT_CALL, STAT, MODE, "krl_fprintf", HANDLE, "%s%c%c",sText[],LineFeed,CarriageReturn)
    
    
     CWRITE($FCT_CALL, STAT, MODE, "krl_fprintf", HANDLE, "%s: %s%c%c%c%c","Module",sModul[],LineFeed,CarriageReturn,LineFeed,CarriageReturn)
    
    
     wait sec 0
    
    
     
    
    
     ; close the file
    
    
     CWRITE($FCT_CALL, STAT, MODE, "krl_fclose", HANDLE)
    
    
     IF (STAT.RET1 == #CMD_ABORT) THEN
    
    
     ; error treatment
    
    
     ENDIF
    
    
    ;ENDFOLD
    
    
    
    END
    Display More

    Edited once, last by paranoidandroid (January 8, 2020 at 8:46 PM).

  • paranoidandroid
    Reactions Received
    2
    Trophies
    3
    Posts
    26
    • January 8, 2020 at 8:29 PM
    • #14

    Including a snippet of code for drive mounting the local D:/, per PanicMode. Unfortunately I'm receiving a STATE.RET1 = #CMD_ABORT on this (MSG_NO -2, Operation failed: mount point not (or no longer) available.).

    I don't see any indication for why this would happen. I've tried the following iterations for mounting address:

    - //192.168.0.1/Log

    - //192.168.0.1/d/Log

    - //192.168.0.1/d

    - //192.168.0.1/

    I receive a MSG_NO: -2 in each of those cases.

    Code
    DEF DRIVEMOUNTTEST()
    
    DECL STATE_T STATE
    DECL MODUS_T MODE
    
    CWRITE($FCT_CALL,STATE,MODE,"krl_mount","/Log","//192.168.0.1/d/Log","KukaUser","0E76390E88C27932C9816D326AF12CEA2B")
    
    WAIT SEC 5
    
    CWRITE($FCT_CALL,STATE,MODE,"krl_unmount","/Log")
    
    END
    Display More
  • Online
    panic mode
    Reactions Received
    1,278
    Trophies
    11
    Posts
    13,079
    • January 8, 2020 at 11:10 PM
    • #15

    looks like lomaxe made couple of mistakes. for example the user name and password are case sensitive and he was using "KUKAUser" instead of "KukaUser" in his code. also it seems he did not generate password hash correctly.

    about that...

    i have shown how to run khash to get result displayed but i did not test if the hash actually works... his pursuit of this thread stopped so i assumed he spotted the typos and got it working eventually.

    but today, after seeing your post, i decided to give a try and found that it does not work for me either... well i may need to use this feature so .... this was ...not acceptable.

    so i tried few things and concluded that problem is khash itself. info about using khash is actually completely WRONG... and that is both in manuals and as displayed on a command line by khash.exe itself. it looks like programmers at some point changed behaviour and this wasn't communicated to technical writers. and you know that writers would just take it as presented rather than try things out for themselves to see if their manuals are actually usable.

    so this is what happened:

    1. created folder D:\test2

    2. shared it

    3. gave everyone full access (no time to experiment)

    4. tried to reach the shared folder -> it worked

    5. created crude program using "KukaUser" and generated hash, triple checked it ... and it failed to run... until i tried to generate hash using USER NAME instead of PASSWORD. and vila... then it worked.

    i created new standard user (purposely not Admin) and with new password of course.

    generated hash and tested it again - all is fine at least when it comes to krl_mount.

    1) read pinned topic: READ FIRST...

    2) if you have an issue with robot, post question in the correct forum section... do NOT contact me directly

    3) read 1 and 2

  • paranoidandroid
    Reactions Received
    2
    Trophies
    3
    Posts
    26
    • January 9, 2020 at 12:53 AM
    • #16

    Panic Mode,

    Thanks for looking into it.

    Still running into the frustrating result of getting a STAT.RET1 = #CMD_ABORT and MSG_NO = -32 (Mount point not found.) Code below...

    Code
    DEF NewBillingTester(sText[]:IN, sModul[]:IN , iIndex:OUT) 
    
    DECL INT HANDLE, Offset, iIndex
    DECL STATE_T STAT, STATE_TE
    DECL MODUS_T MODE
    
    CHAR FileName[256], FilePath[256], ProjectName[256]
    CHAR sText[],sModul[]
    CHAR CarriageReturn
    CHAR LineFeed
    
    
    CarriageReturn = 13
    LineFeed = 10
    ProjectName[] = "TestProject"
    FilePath[] = "/Log/"
    
    MODE = #SYNC
    HANDLE = 0
    
    ;FOLD Entry and Index line
    ;Edit character string
    Offset = 0
    
    CWRITE($FCT_CALL,STAT,MODE,"krl_unmount","/Log")
    CWRITE($FCT_CALL,STAT,MODE,"krl_mount","/Log","//192.168.0.1/Log","080AEFB997865D66AE9E59D4610A20C96E","68kuka1secpw59") ; Username hash is "KukaUser"
    
    ;FileName Creation per Month
    SWRITE(FileName[],STATE_TE,Offset,"%s%sBilling_%02d_%d.txt",FilePath[],ProjectName[],$DATE.Month,$DATE.YEAR)
    
    CWRITE($FCT_CALL, STAT, MODE, "krl_fopen", FileName[],"a", HANDLE)
    Display More

    Truncated the rest of the code, as STAT.RET1 returns #CMD_ABORT at this point.

    Edited once, last by paranoidandroid (January 9, 2020 at 6:10 PM).

  • Online
    panic mode
    Reactions Received
    1,278
    Trophies
    11
    Posts
    13,079
    • January 9, 2020 at 2:38 AM
    • #17

    your line 26 is wrong. you are trying to use password in both fields, first as hashed and then as plain text.

    that is wrong. check manual and my screenshot.

    user name is not hashed - password is.

    HASH.EXE utility generates password hash but rather than passing password, one need to pass user name as parameter. but what comes out scrambled is a password.

    1) read pinned topic: READ FIRST...

    2) if you have an issue with robot, post question in the correct forum section... do NOT contact me directly

    3) read 1 and 2

  • Online
    SkyeFire
    Reactions Received
    1,051
    Trophies
    12
    Posts
    9,423
    • January 10, 2020 at 3:49 PM
    • #18

    ...Hold on. You run khash USERNAME, and get the hash for the password? How does khash know the password, to create the hash from, in that case?

    If you're running it to get "local" access to an account on the robot, khash could be accessing the password for that account somehow. But if the account you're trying to access only exists on a remote computer, khas would have no way of generating a valid SMB password hash for that remote account.

  • Online
    panic mode
    Reactions Received
    1,278
    Trophies
    11
    Posts
    13,079
    • January 10, 2020 at 4:23 PM
    • #19

    it has to be run on a target system

    1) read pinned topic: READ FIRST...

    2) if you have an issue with robot, post question in the correct forum section... do NOT contact me directly

    3) read 1 and 2

  • paranoidandroid
    Reactions Received
    2
    Trophies
    3
    Posts
    26
    • January 10, 2020 at 7:00 PM
    • Best Answer
    • #20

    So I reached out to KUKA directly on this issue, wanted to follow up on couple of things:

    1. I'd originally tested this on KSS 8.5.7 HF1, which it turns out has a lot to do with the problems I've been tracking. It will successfully mount the local drive (in this instance, a directory on the shared D:/ drive). After mounting, if you try to run the "krl_fopen" command on HF1, it will fail. I attempted this same code with KSS 8.5.8 with no issues (unmount and mount D:/, make a new directory on the mounted drive, fopen, fprintf, etc). So it appears the KSS has something to do with this bug. My recommendation to anyone running into this issue w/ HF1 is to upgrade your software to the next stable version.

    2. The documentation per KUKA on the khash.exe is correct (based on a reliable POC at KUKA Robotics in Detroit). I think this got a little confused, and I wanted to be clear. I'm able to successfully unmount / mount D:/ with the following on KSS 8.5.8:

    Code
    CWRITE($FCT_CALL,STAT,MODE,"krl_unmount","/MountDrive")
    CWRITE($FCT_CALL,STAT,MODE,"krl_mount","/MountDrive","//192.168.0.1/d","kukauser","0E76390E88C27932C9816D326AF12CEA2B")

    Note that "kukauser" is case sensitive. Hashed password is "68kuka1secpw59"

    Everything else that followed worked successfully after the drive mount, including using:

    - krl_fopen

    - krl_mkdir

    - krl_fprintf

Advertising from our partners

IRBCAM
Robotics Channel
Robotics Training
Advertise in robotics
Advertise in Robotics
Advertise in Robotics

Job Postings

  • Anyware Robotics is hiring!

    yzhou377 February 23, 2025 at 4:54 AM
  • How to see your Job Posting (search or recruit) here in Robot-Forum.com

    Werner Hampel November 18, 2021 at 3:44 PM
Your browser does not support videos RoboDK Software for simulation and programming

Tag Cloud

  • abb
  • Backup
  • calibration
  • Communication
  • CRX
  • DCS
  • dx100
  • dx200
  • error
  • Ethernet
  • Ethernet IP
  • external axis
  • Fanuc
  • help
  • hmi
  • I/O
  • irc5
  • IRVIsion
  • karel
  • kawasaki
  • KRC2
  • KRC4
  • KRC 4
  • KRL
  • KUKA
  • motoman
  • Offset
  • PLC
  • PROFINET
  • Program
  • Programming
  • RAPID
  • robodk
  • roboguide
  • robot
  • robotstudio
  • RSI
  • safety
  • Siemens
  • simulation
  • SPEED
  • staubli
  • tcp
  • TCP/IP
  • teach pendant
  • vision
  • Welding
  • workvisual
  • yaskawa
  • YRC1000

Thread Tag Cloud

  • abb
  • Backup
  • calibration
  • Communication
  • CRX
  • DCS
  • dx100
  • dx200
  • error
  • Ethernet
  • Ethernet IP
  • external axis
  • Fanuc
  • help
  • hmi
  • I/O
  • irc5
  • IRVIsion
  • karel
  • kawasaki
  • KRC2
  • KRC4
  • KRC 4
  • KRL
  • KUKA
  • motoman
  • Offset
  • PLC
  • PROFINET
  • Program
  • Programming
  • RAPID
  • robodk
  • roboguide
  • robot
  • robotstudio
  • RSI
  • safety
  • Siemens
  • simulation
  • SPEED
  • staubli
  • tcp
  • TCP/IP
  • teach pendant
  • vision
  • Welding
  • workvisual
  • yaskawa
  • YRC1000
  1. Privacy Policy
  2. Legal Notice
Powered by WoltLab Suite™
As a registered Member:
* You will see no Google advertising
* You can translate posts into your local language
* You can ask questions or help the community with your knowledge
* You can thank the authors for their help
* You can receive notifications of replies or new topics on request
* We do not sell your data - we promise

JOIN OUR GREAT ROBOTICS COMMUNITY.
Don’t have an account yet? Register yourself now and be a part of our community!
Register Yourself Lost Password
Robotforum - Support and discussion community for industrial robots and cobots in the WSC-Connect App on Google Play
Robotforum - Support and discussion community for industrial robots and cobots in the WSC-Connect App on the App Store
Download