Thanks bart-janssen!
If you select your shader, run this code:
`import maya.cmds as cmds
sel = cmds.ls(sl=True)
print sel[0]
bump = cmds.listConnections(sel[0], type = 'bump2d')
textures = cmds.listConnections(sel[0], type = 'file')
for x in bump:
[4spaces]cmds.getAttr(x + '.bumpValue')
[4spaces]bumpTexture = cmds.listConnections(x, type = 'file')
[4spaces]print cmds.getAttr(bumpTexture[0] + '.fileTextureName')
for x in textures:
[4spaces]print cmds.getAttr(x + '.fileTextureName')`
This gives you all connected textures to your selected shader.