Is there a way to configure OSX to auto mount and SMB share without entering a user and password into the configuration file? I've found instructions on how to auto mount an SMB share, but they either involve adding the share to the login items (I'm using a laptop and that gives me an error when I'm not in the same network as the SMB share), or adding my login and password into the fstab or auto_master file (if I change my password, as I should, I have to go reconfiguring the system).

My user and password are stored in the keychain, and I only want the system to mount the share when I'm in the same network. I'm lazy and I want this to happen automatically. Is it possible?
Yes, it is possible, but you'll either need an non-lazy friend or put in the work yourself in order to set it up.

First thing I thought of was creating a shell script that monitors your networks connection details and executes the appropriate autologin and automount commands when it sees that you are connecting to the right network.

So, to answer your original question, yes it is possible.